admin管理员组文章数量:1405880
I am currently developing a plugin for a gym where the admin can manage all the gym members in admin area through create/add new members, view/read, edit and delete them. I first started off by creating custom menu item (add_menu_page - "Badar's Gym") and a sub menu ("Add Member") under that. I have completed the "Adding member" part, which saves all the fields in a custom table in WordPress database and "Showing all the entries part" on page where it says "Angel Builder Dashboard". Here are the screenshots.
The problem here is i want to show a full detailed page for a particular member/entry when the view button is clicked(also for edit). Normally in php projects you create a view.php(or something similar) page and show a particular entry there. How i can achieve that here without creating a new add_menu_page?
One more problem i am facing here is after the add member form has been submitted i try to redirect the user to "badar's Gym" page where it lists all the entries using wp_redirect() but it gives me these errors:-
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\wordpress\wp-includes\formatting.php:5652) in C:\xampp\htdocs\wordpress\wp-includes\pluggable.php on line 1265
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\wordpress\wp-includes\formatting.php:5652) in C:\xampp\htdocs\wordpress\wp-includes\pluggable.php on line 1268
Here is my code for redirecting:-
if (isset($_POST['submit_add_member'])) {
//Performs all validation and other tasks here
......
....
..
//Redirect user to main plugin page(Dashboard) if no errors are found
$badar_redirect_url = admin_url('admin.php?page=badar-gym');
//--------------------Redirection needs to be fixed, it is outputting headers already sent error
wp_redirect( $badar_redirect_url );
}//End If statement
}//End If statement
I am fairly new to WordPress so any help would be appreciated :)
本文标签:
版权声明:本文标题:plugin development - How to create a "View" page for entry in add_menu_page wordpress admin area (CRUD operati 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744948379a2633925.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论