Search posts by ID in admin

Not sure i understand why you’d want to query by ID, but that said it’s possible in a hacky kind of way(i like this method because it’s simple). add_action( ‘parse_request’, ‘idsearch’ ); function idsearch( $wp ) { global $pagenow; // If it’s not the post listing return if( ‘edit.php’ != $pagenow ) return; // If … Read more

How to Add a Third Level Sub Menu to the WordPress Admin Menu

No, it is not possible to create third level menu in admin panel. If you look at the definition of add_submenu_page, you need to mention the parent slug name. For eg: add_menu_page ( ‘Test Menu’, ‘Test Menu’, ‘read’, ‘testmainmenu’, ”, ” ); add_submenu_page ( ‘testmainmenu’, ‘Test Menu’, ‘Child1’, ‘read’, ‘child1’, ”); The first parameter of … Read more

if admin is logged in

current_user_can will accept a role name but, sadly, the behavior with roles is not entirely consistent. The following should work and is simpler than what you have, by a little bit. $current_user = wp_get_current_user(); if (user_can( $current_user, ‘administrator’ )) { // user is an admin }

Admin: very slow edit page caused by core meta query

If you want to test your custom SQL to see how it affects the loading time, you can try this query swapping: /** * Restrict the potential slow query in the meta_form() to the current post ID. * * @see http://wordpress.stackexchange.com/a/187712/26350 */ add_action( ‘add_meta_boxes_post’, function( $post ) { add_filter( ‘query’, function( $sql ) use ( … Read more

Changing the “Plugin Activated” Message Default

You can try this: is_admin() && add_filter( ‘gettext’, function( $translated_text, $untranslated_text, $domain ) { $old = array( “Plugin <strong>activated</strong>.”, “Selected plugins <strong>activated</strong>.” ); $new = “Captain: The Core is stable and the Plugin is <strong>activated</strong> at full Warp speed”; if ( in_array( $untranslated_text, $old, true ) ) $translated_text = $new; return $translated_text; } , 99, … Read more

Create tabs inside Plugins Admin Page [closed]

I advice you to read this topic: Here you can find complete guide making options page with tabbed content. Or you can just copy the html of the tabbed page that you’ve liked, and use it on your own options page. I made my options page with tabs too, but with api. Tabs and the … Read more

How to pass parameters to admin_notices?

I think a better implementation would be a “message” class e.g.: class WPSE_224485_Message { private $_message; function __construct( $message ) { $this->_message = $message; add_action( ‘admin_notices’, array( $this, ‘render’ ) ); } function render() { printf( ‘<div class=”updated”>%s</div>’, $this->_message ); } } This allows you to instantiate the message at any time prior to rendering: … Read more

How can I speed up my WP admin section?

jQuery / JavaScript in the footer One thing you can do is to move jQuery to the footer blog post. It’s per default not needed in the header. You will have check if everything still works tough, as I normally just do that for themes: <?php /* Plugin Name: Move jQuery to the footer */ … Read more

Disable SSL / HTTPS for wordpress

Check your wp-config.php file for lines like: define( ‘WP_SITEURL’, ‘https://example.com’ ); define( ‘WP_HOME’, ‘https://example.com’ ); Also check your database’s {prefix}_options table: SELECT * FROM wp_options WHERE option_name=”siteurl” OR option_name=”home”; …assuming that your database’s prefix is wp_.

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