Bulk Delete Users Error uri too large

I would shy away from trying to do this is SQL. It is possible but probably not necessary and is more prone to error that using WordPress Core functions. You could use get_users() or WP_User_Query to retrieve your users but given that you only want to keep two users and you only need the ID … Read more

Wrong canonical link on wp-admin pages

wp-admin-canonical is broken, as it assumes how WordPress is installed. there was a plugin to fix it, but the plugin was removed from the plugin repository apparently. It is still on github and pluginmirror though: https://github.com/wp-plugins/remove-wp-canonical-url-admin-hack http://www.pluginmirror.com/plugins/remove-wp-canonical-url-admin-hack/

how to force caching of wordpress admin

your problem is not with the admin pages themself, they are simply not big enough to be hugely impacted by slow connection, but with JS and CSS files. You can set an expiry date for them which will signal to the browser it may cache them until that time. To cache them for a week … Read more

Only allow administrators and editors to access wp-admin

You’re correct in that you should be checking for a capability. However, manage options is only given to administrators by default. You should check against a capability that both editors and administrators have such as delete_others_posts. function restrict_admin(){ //if not administrator, kill WordPress execution and provide a message if ( ! current_user_can( ‘delete_others_posts’ ) ) … Read more

Can I add custom attributes while adding inline scripts?

Here’s one demo suggestion: add_action( ‘admin_enqueue_scripts’, function() { wp_enqueue_script( ‘my-script’, ‘/my-script.js’, [‘underscore’, ‘backbone’], ‘1.0’ ); wp_add_inline_script( ‘my-script’, ‘alert(“hello world”);’ ); // Add our template if( function_exists( ‘wpse_add_inline_tmpl’ ) ) wpse_add_inline_tmpl( $handle=”my-script”, $id = ‘my-tmpl’, $tmpl=”<div class=”section intro”>{{{ data.section.intro }}}</div>” ); } ); where we define our custom wpse_add_inline_tmpl() function as: function wpse_add_inline_tmpl( $handle, $id, $tmpl … Read more

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