Sub Menu content is being duplicated

I was using the same page name for both. You can see in this snippet that I used “BCRM” and I didn’t realize it. add_submenu_page( __FILE__, ‘BCRM Customer Settings’, ‘Customer Settings’, ‘administrator’, ‘**BCRM**’, ‘bcrm_customer_settings_page’); add_submenu_page( __FILE__, ‘BCRM Form Settings’, ‘Form Settings’, ‘administrator’, ‘**BCRM**’, ‘bcrm_form_settings_page’); I changed them to BCRM_customers and BCRM_forms respectively and it is … Read more

How to show a gloabl message on a user profile page (in back end)?

add this code to your function.php <?php function showMessage($message, $errormsg = false) { if ($errormsg) { echo ‘<div id=”message” class=”error”>’; } else { echo ‘<div id=”message” class=”updated fade”>’; } echo “<p><strong>$message</strong></p></div>”; } function showAdminMessages() { showMessage(“This is my message.”, true); } add_action(‘admin_notices’, ‘showAdminMessages’); ?>

Make menu page link inaccessible or disabled

To do that use the following function: add_action( ‘admin_menu’, ‘custom_menu_page_removing’ ); function custom_menu_page_removing() { global $pagenow; if ( !current_user_can( ‘administrator’ ) ) { $menu = array( ‘edit.php’, ‘edit-comments.php’ ); foreach ( $menu as $main ) { remove_menu_page( $main ); } if ( in_array( $pagenow, $menu, true ) && ( !isset( $_GET[‘post_type’] ) || isset( $_GET[‘post_type’] … Read more

Global State During an Admin Post

When using admin-post.php, no loaded menus on an admin-post.php request is standard wordpress behavior. Standard practise to redirect after processing done on post action hook is to use: wp_redirect( admin_url( ‘admin.php?page=YOUR_PAGE’ ) ); When using admin-post.php, wordpress will include wp-admin/includes/wp-admin.php instead of wp-admin/wp-admin.php ( WordPress Admin Bootstrap ) to skip some setup. One of the … Read more

Single category’s posts list in admin menu

The best approach would be to create a custom post type “News” and hide the menu item of “posts” – The code below will create a Custom post type for news /* * Creating a function to create our CPT */ function custom_post_type() { // Set UI labels for Custom Post Type $labels = array( … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)