Completely disabling widgets

One option would be to simply flush the widget code out of the sidebar.php file, as well as the header/footer/post pages if they are using widgets. However, take a peek at this code snippet (courtesy of this site), which you can add to your functions.php file and will disable the widgets. I think this would … Read more

How i add new link after Edit | Quick Edit | Trash | View in quick edit section

You can do it by creating a hook for post_row_actions filter. If your CPT is hierarchical post type use page_row_actions filter. add_filter( ‘post_row_actions’, ‘wpse8170_row_actions’, 10, 2 ); function wpse8170_row_actions( $actions, WP_Post $post ) { if ( $post->post_type != ‘my-custom-post-type’ ) { return $actions; } $actions[‘wpse8170-pdf’] = ‘<a href=”http://your/url/here”>PDF</a>’; return $actions; }

remove_meta_box for all post types doesn’t seem to work

Remember Apple’s “Goto Fail”? Similar situation: Your code actually does this, when indentation is corrected: foreach ( $post_types as $post_type ) remove_meta_box(‘trackbacksdiv’, $post_type, ‘normal’); remove_meta_box(‘postcustom’, $post_type, ‘normal’); remove_meta_box(‘authordiv’, $post_type, ‘normal’); remove_meta_box(‘postexcerpt’, $post_type, ‘normal’); So, it should does the job for trackbacksdiv, but not for the rest because the function calls are outside of the foreach … Read more

How to remove bulk edit options

A more reliable approach than messing with CSS would be to add some Javascript in the admin_head action, and basically override the built-in “inlineEditPost” function (located in wp-admin/js/inline-edit-post.js and easier to read in inline-edit-post.dev.js). I haven’t looked into it much specifically, but the brute force method would be to copy (and rename) that entire function … Read more

How to prevent parent admin page from appearring as a child admin page

Unless I misunderstand the question, this should do the trick: add_action(‘admin_menu’, ‘add_menu_pages’); function add_menu_pages() { add_menu_page(‘Menu Title’, ‘Menu Title’, 10, ‘main_menu’, ‘submenu_1_callback’); add_submenu_page(‘main_menu’, ‘Sub Menu Title 1’, ‘Sub Menu Title 1’, 10, ‘main_menu’ , ‘submenu_1_callback’); add_submenu_page(‘main_menu’, ‘Sub Menu Title 2’, ‘Sub Menu Title 2’, 10, ‘sub_menu’ , ‘submenu_2_callback’); } function submenu_1_callback() { echo “<h2>” . … Read more

WooCommerce – filter by featured products in admin

You can sort your products list by the featured status. Just click on the star at the top of the column…. once will put all non-featured items at the top, and twice should reverse this and put all featured items at the top. Your admin url will look like: /wp-admin/edit.php?post_type=product&orderby=featured&order=desc EDIT: Ok, so it turned … Read more