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 use thickbox in admin?

Below, an example of what’s needed to use ThickBox. <?php wp_enqueue_style(‘thickbox’); wp_enqueue_script(‘thickbox’); ?> <a href=”#” id=”taxonomy_banner_image” class=”taxonomy_banner_image”> Click Here </a> <script type=”text/javascript”> jQuery(document).ready(function() { jQuery(“#taxonomy_banner_image”).click(function() { tb_show(“”, “filename?TB_iframe=true”); return false; }); }); </script> tb_show parameters: title of the box. url of file and with parameter iframe=true I think this will give you an idea how … Read more

Site Title and Tagline in Theme Options Page

The framework offers a filter for validating input values inside the optionsframework_validate function. Just for reference, here’s the relevant part from the file wp-content/themes/your-theme/inc/options-framework.php: /** * Validate Options. * * This runs after the submit/reset button has been clicked and * validates the inputs. */ function optionsframework_validate( $input ) { /* code */ $clean[$id] = … Read more

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

Add content before/after admin post wp-list-table

This has probably been solved many times here on this site, but maybe not with all your requirements? So let me try to answer it here: You can try to use the all_admin_notices and in_admin_footer actions, wrapped inside the load-edit.php action to target the edit.php page: add_action( ‘load-edit.php’, function(){ $screen = get_current_screen(); // Only edit … 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