How to remove “publish metabox” from each post type

If you’re familiar with Browser Developer Tools you can quickly find the metabox ID ( which is the container div id ). In this case it’s called submitdiv. We can remove it by using the remove_meta_box() function which has a format like this: remove_meta_box( ‘metabox_id’, ‘post_type’, ‘default_position’ ); remove_meta_box( ‘submitdiv’, ‘post’, ‘side’ ); Here’s a … Read more

Get current logged in user under 3.1, re: remove “Howdy”

Why fiddle around with jQuery when you could just run a filter on gettext to specifically target that text? Perhaps you simply don’t know you can do that, so here’s how.. add_filter( ‘gettext’, ‘change_howdy_text’, 10, 2 ); function change_howdy_text( $translation, $original ) { if( ‘Howdy, %1$s’ == $original ) $translation = ‘Logged in as %1$s’; … Read more

How to disable automatic excerpt generation *in admin*?

Just illustrating this in full effect here with the filters and functions for both the adding of custom column and testing for excerpt existence. Note, I’ve purposely ripped the guts out of has_excerpt to show you in effect what is occurring under the hood. You can use !has_excerpt in its place. add_filter(‘the_excerpt’, ‘no_excerpt’); add_filter(‘manage_posts_columns’ , … Read more

disable admin-bar search field for specific roles

Just in case anyone trips over this…here’s how you remove “search” and some examples of other things you can remove from the admin bar: public function remove_admin_menu_bar_items ($wp_toolbar) { $wp_toolbar->remove_node( ‘my-sites’ ); $wp_toolbar->remove_node( ‘wp-logo’ ); $wp_toolbar->remove_node( ‘new-content’ ); $wp_toolbar->remove_node( ‘view’ ); $wp_toolbar->remove_node( ‘logout’ ); //remove “logout” under “howdy” $wp_toolbar->remove_node( ‘user-info’ ); //remove “youraccount” under “howdy” … Read more

Where does WordPress store a list of Super Admins?

It’s stored in the main site options table, under the “site_admins” key. Edit: As pointed out in the comments, the “site options” table in multisite is actually named PREFIX_sitemeta, like “wp_sitemeta”. It’s referred to as a site option internally, like get_site_option(‘site_admins’). To adjust this without editing the database content directly, you could do this: $capes … Read more

Admin: global $post empty

The basic mistake is, that every data is available at the point where you write your code. That isn’t the case and hooks are there to provide access to the core code during different states of the core loading procedure graph. In short and very simplified things run like this: # core loads // …more … Read more

How to change admin menu position of “Media”?

There’s a combination of two filters, menu_order does the job, but you also use custom_menu_order to enable menu_order. function wpse_233129_custom_menu_order() { return array( ‘index.php’, ‘upload.php’ ); } add_filter( ‘custom_menu_order’, ‘__return_true’ ); add_filter( ‘menu_order’, ‘wpse_233129_custom_menu_order’ ); This will put upload.php (the Media screen) just after the Dashboard and then the other top-level menu items will follow. … Read more

How to enable enqueue_script to work with a logged in user?

Additionally, apart from the “where” of your wp_enqueue_script() function (i.e. theme, plugin, etc.), the “when” is also important, in terms of WP’s Action Reference hooks, and the order in which they’re fired. There are 2 distinct script-related hooks, wp_enqueue_scripts and admin_enqueue_scripts, which allow for separation of scripts and styles depending on which view the user … Read more

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