List table not rendering when $this->items is filled

I did same error first time I implemented WP_List_Table. The problem is that when you call WP_List_Table::display() WordPress in turn calls: WP_List_Table::display_rows_or_placeholder() WP_List_Table::display_rows() WP_List_Table::single_row() WP_List_Table::single_row_columns() Last function is called for every row. If you look at its code (see source), it has: if ( ‘cb’ == $column_name ) { // you don’t have ‘cb’ column, … Read more

Add visit site to your toolbar instead of being in the dropdown

Not complicated, but a little tricky to get timing right. Something like this should work, but you might need to experiment with priority to get the link to specific position on the bar: add_action( ‘admin_bar_menu’, function ( $wp_admin_bar ) { if ( ! is_admin() ) { return; } /** @var WP_Admin_Bar $wp_admin_bar */ $wp_admin_bar->remove_node( ‘view-site’ … Read more

Admin menu as submenu from another plugin

Trying to simulate the issue, it happened the same (wp-admin/submenu_slug), and the solution is to add a priority value in the hook admin_menu. Here, I’m adding a sub menu to the plugin BackWPup. Note the priority 11: add_action(‘admin_menu’, ‘third_party_submenu_wpse_91377’, 11 ); function third_party_submenu_wpse_91377() { add_submenu_page( ‘backwpup’, // Third party plugin Slug ‘My plugin’, ‘My plugin’, … Read more

Add my own button next to “Screen options” and “Help” in the admin

The HTML echo ‘<div id=”screen-meta-links”>’; echo ‘ <div id=”contextual-help-link-wrap” class=”hide-if-no-js screen-meta-toggle”>’; echo ‘ <a href=”#” id=”your-own-button” class=”show-settings”>Text for your button</a>’; echo ‘ </div>’; echo ‘</div>’; echo ‘<br style=”clera:both” />’; echo ‘<div id=”your-button-content” class=”your-button-hide”>’; // your content goes here echo ‘</div>’; And you need some custom JavaScript jQuery(document).ready( function($){ $( ‘.your-button-hide’ ).each( function(e){ $( this ).hide(); … Read more

Remove a menu item created by a plugin

function remove_submenu() { remove_submenu_page( ‘edit.php’, ‘edit-tags.php?taxonomy=faq-topic&post_type=question’ ); remove_submenu_page( ‘edit.php’, ‘edit-tags.php?taxonomy=faq-tags&post_type=question’ ); } add_action( ‘admin_menu’, ‘remove_submenu’, 999 ); Please read the Codex. remove_submenu_page() need two parameters and the right hook. And very important: Use a very, very, very high priority in your hook! If you use a low priority, your function will be executed before the … Read more

Plugin to remove Admin menu items based on user role?

Update: reading mike’s answer again got me thinking that you can add a new capability to a role and use that as you removal condition, so: // first add your role the capability like so // get the “author” role object $role = get_role( ‘administrator’ ); // add “see_all_menus” to this role object $role->add_cap( ‘see_all_menus’ … Read more

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