WordPress disable ‘Install Themes’ tab

You can essentially ‘block’ the capability install_themes using; function __block_caps( $caps, $cap ) { if ( $cap === ‘install_themes’ ) $caps[] = ‘do_not_allow’; return $caps; } add_filter( ‘map_meta_cap’, ‘__block_caps’, 10, 2 );

lock meta box position on post edit screen for contributors

Found this while trolling the internets… Works Perfectly add_action(‘admin_init’, ‘set_user_metaboxes’); //I want it to fire every time edit post screen comes up //add_action(‘user_register’, ‘set_user_metaboxes’); //You can also have it only set when a new user is created function set_user_metaboxes($user_id=NULL) { //These are the metakeys we will need to update $meta_key[‘order’] = ‘meta-box-order_events’; $meta_key[‘hidden’] = ‘metaboxhidden_events’; … Read more

Get which template being in use within WordPress-admin

Basically this isn’t available in admin. You can take a look at my profile, go to my github page and grab the “current admin info” plugin. But this won’t help you much. This would show you the template name: get_page_template_slug( get_queried_object_id() ); On the front end you can use the following plugin, that will display … Read more

Post Bulk Update

1) Create a new page and assign a new page template to it, lets say site.com/update and update.php. Inside of update.php write you bulk mechanism: <?php // grab all your posts $parts = get_posts(array(‘post_type’ => ‘parts’, ‘numberposts’ => -1,)) // loop through every part foreach ( $parts as $part ) { // get part number … Read more

Share Tags Between Custom Posts in Admin

When you register_taxonomy you can simply add an array of post_types to $object_type parameter. From WordPress-codex: (array/string) (required) Name of the object type for the taxonomy object. Object-types can be built-in objects (see below) or any custom post type that may be registered. So you can just add an array of post_types after you run … Read more

What is wrong with this code to remove wp admin bar from one page

You need to remove the (!) infront of the conditional, you can read about PHP-operators here. Now you simply say that if not on page “image-upload” remove the admin_bar.. Here is the working code: <?php function wpse_80018_hide_admin_bar() { // If is on page “image-upload” // Remove the admin_bar if ( is_page(‘image-upload’) ): show_admin_bar(false); endif; } … Read more

WordPress Options Page not working

The problem part is this line: <form method=”post” action=”options.php”> This sends your form to wp-admin/options.php (and I guess you’re not sending the form from this URL). Leave the action value empty like this: <form method=”post” action=””> And your form will send itself to the same page from which it was sent. Then you can save … Read more