Home › Forums › Feature Requests › Ability to Link to Specific Tabs on Options Page › Reply To: Ability to Link to Specific Tabs on Options Page
I am doing this on some of my sites with the following code. YMMV performance wise having this inline, in an enqueued file, etc depending on the specific implementation:
add_action( "admin_footer", "acf_link_to_tab" );
function acf_link_to_tab(){ ?>
<script>
(function($){
acf.add_action('ready', function(){
if (location.hash.length>1){
var hash = location.hash.substring(1);
$('.acf-tab-wrap .acf-tab-button').each(function(i, button){
if (hash==$(button).text().toLowerCase().replace(' ', '-')){
$(button).trigger('click');
return false;
}
});
}
});
})(jQuery);
</script><?php
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.