Moving wp-admin to a different to a subdomain

I’m using BitNami WAMPStack, but theoretically it could be used for a Linux installation Here is how I did it: 1) Installed BitNami WAMPStack on secondary server. 2) Deleted the secondary servers’ htdocs folder and copied the entire htdocs folder from the primary to the secondary server. 3) open “C:\Program Files\BitNami WAMPStack\apps\wordpress\htdocs\wp-config.php” and edit section … Read more

Associating custom submenu item with post type of top level menu item

You need the information about the current post type in your callback function that renders the submenu page output. And at this point there is a lot of information ready: add_action( ‘admin_menu’, ‘wpse_60730_demo_submenu’ ); /** * Register sub menu pages. * * Note that get_current_screen() is still NULL now. * * @wp-hook admin_menu * @return … Read more

How to check if upload window came from the featured image link?

There is a filter for the html of the ‘postimagediv’ called ‘admin_post_thumbnail_html’. There may be more elegant ways, but this works: add_filter(‘admin_post_thumbnail_html’, ‘wpse61502_change_thumbnail_link’); function wpse61502_change_thumbnail_link($content) { return str_replace(‘media-upload.php?’, ‘media-upload.php?is_thumbnail=true&’, $content); } In your plugin / script check the querystring: if ( isset($_GET[‘is_thumbnail’]) ) { // do stuff, actions, enqueue, … }

Add Post Screen Keep Category structure

Yup. Use the add_meta_boxes_post to add a new category metabox that preserves the structure and while you’re at it, remove the default one, like this: add_action( ‘add_meta_boxes_post’, ‘fix_hierarchical_post_categories_metaboxes’, 10, 1 ); And here’s the callback: /* * This include provides an alternative post category metabox that sets the checked_ontop argument of wp_terms_checklist to false. * … Read more

Auto create post title in admin

the_title filter filters the existing title when it’s output on the front end. If you want to set a title when a post is created on the back end, you want to use the title_save_pre filter: function wpa65253_time_title( $title ) { global $post; if ( isset( $post->ID ) ) : if ( empty( $_POST[‘post_title’] ) … Read more

How to Sort the Favorite Plugins Screen Alphabetically?

That page is rendered by the WP_Plugin_Install_List_Table class, which calls the function plugins_api(). In this function, we find two filter hooks that enable the manipulation of the table output: plugins_api_args and plugins_api_result. The problem is that the API doesn’t offer an ordered query, so we can only sort each page results. The solution is to … Read more