1

I'm looking to have the "most used tags" link within the tag meta box on the post page always be expanded. Couldn't find any helpful plugins to use.

I did find this previous post but the function doesn't seem to be working anymore - I'm wondering if something has changed since that was in 2012.

2
  • Thanks @Castiblanco - It's actually an internal site hidden by IP so I'm not sure I'll be able to let you browse it. I haven't modified the tagsdiv-article-tag meta box in any way if that is helpful. It is on a custom post type though with the type as post_type=article. I wonder if I need to qualify that it's on that page somehow?
    – Collin
    Jul 10, 2018 at 20:28
  • Let me know if you have any problem implementing my solution Jul 10, 2018 at 22:42

1 Answer 1

0

You can do this using jQuery.

First of all, you need to add your script into your functions.php

function my_theme_scripts() {
    wp_enqueue_script( 'expand-tags', get_site_url() . '/js/expand-tags.js', array( 'jquery' ), '1.0.0', true );
}

add_action( 'admin_enqueue_scripts', 'my_theme_scripts' );

Then, in your file (expand-tags.js) which is located on, for example, public_html/mysite/js/, you will have to have something like this:

$(document).ready(function() {
   $("#link-post_tag").trigger("click");
});

link-post_tag is the ID of the Choose from the most used tags button, so when the page is loaded, a button click will be triggered.

2
  • Thank you so much - worked like a charm!!! Ended up just needing to switch #link-post_tag to #link-article-tag since the custom-post had some adjustments, but it's perfect.
    – Collin
    Jul 11, 2018 at 3:28
  • Don't forget to mark the answer as correct, glad it helped! Jul 11, 2018 at 4:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.