How to save dismissable notice state in WP 4.2?

There’s no need for a library, it’s fairly straightforward to accomplish. If you are coding your own plugin (which it appears you are), then you can do this in a fairly lightweight way: A slightly modified version of the notice, which checks if it’s been dismissed before displaying, and stores the “type” of notice in … Read more

How can I change the admin search posts fields?

It is possible, but you’ll have to play a little bit with the actual query. As always, the furious posts_clauses filter comes to action: function wpse_alter_posts_search( $pieces ) { global $wpdb; // Make the input save $search_string = like_escape( $_GET[‘s’] ); // Your new WHERE clause $where = $wpdb->prepare( “$wpdb->postmeta.%s LIKE %s”, ‘YOUR_COLUMN’, // Should … Read more

Multiple custom post types under one admin menu

Just create a “placeholder” menu that you can then assign all your post types to: function wpse_226690_admin_menu() { add_menu_page( ‘Events Manager’, ‘Events Manager’, ‘read’, ‘events-manager’, ”, // Callback, leave empty ‘dashicons-calendar’, 1 // Position ); } add_action( ‘admin_menu’, ‘wpse_226690_admin_menu’ ); And then in your register_post_type calls: ‘show_in_menu’ => ‘events-manager’, Tada!

display all posts in wordpress admin

It doesn’t, in the top right under screen options it says, Show on screen, you can set this to a max of 999 ( I have never tried 999 just fyi) and you can select all, then bulk actions—>edit—>apply. Also I think there are plugins that do this that use direct wpdb functions, so you … Read more

Sort admin menu items

It can be done sorting the global $submenu. The sorting that’s applied resets the key number of the sub-array $submenu[‘options-general.php’], which is: array ‘options-general.php’ => array 10 => array 0 => string ‘General’ 1 => string ‘manage_options’ 2 => string ‘options-general.php’ 15 => array 0 => string ‘Writing’ 1 => string ‘manage_options’ 2 => string … Read more