Display $pagenow error notice on all admin pages

function my_admin_notice() { /* * The class of admin notice should be “notice” plus any one of * -“notice-error”, * -“notice-warning”, * -“notice-success” * -“notice-info”. * Optionally use “is-dismissible” to apply a closing icon. */ echo ‘<div class=”notice notice-info”><p>Custom notice text</p></div>’; } add_action( ‘admin_notices’, ‘my_admin_notice’ ); The only thing is, these notices does not show … Read more

wp-admin does not redirect to dashboard

The problem was in .htaccess. There was an old global .htaccess file (from the old website) besides the wordpress one which was hidden on the sever (by admins of the hosting company) which rewrite rules harmed the ones in wordpress. I actually had to contact the admins and ask them to remove those rewrite rules.

Redirect users away from Admin breaks ajax

You can and a check for the DOING_AJAX constant which is defined on an Ajax in your conditional check: function no_admin_access() { if ( // Don’t do this for AJAX calls ! defined( ‘DOING_AJAX’ ) // Capability check && ! current_user_can( ‘delete_posts’ ) ) { // Redirect to home/front page wp_redirect( site_url( “https://wordpress.stackexchange.com/” ) ); … Read more

Remove order field from Page Attributes box

I went with jQuery to remove the elements. jQuery(document).ready(function() { jQuery(‘#pageparentdiv label[for=menu_order]’).parents(‘p’).eq(0).remove(); jQuery(‘#pageparentdiv input#menu_order’).remove(); });

How can I add my script to admin using script-loader.php?

I think you’e are only registering it with: $scripts->add( ‘user-profile-validator’, …) but not enqueueing it. Check e.g. how wp_register_script() is a wrapper for the WP_Scripts::add() method. Additionally add: wp_enqueue_script( ‘user-profile-validator’ ); in the relevant admin file to enqueue it or add it as a dependency for another enqueued script. Note that password-strength-meter is a dependency … Read more