Support

Account

Forum Replies Created

  • Nice approach, jsilver. I’d add a decodeUriComponent() around the hash to make it support all languages, some non English chars would be automatically encoded by the browser.
    so, something like this:

    
    //add an ACF tab shortcut link
    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){	
    				
    				let hash        = location.hash.substring(1);
    				let decodedHash = decodeURIComponent(hash);
    				
    				$('.acf-tab-wrap .acf-tab-button').each(function(i, button){ 
    					
    					let target = $(button).text().toLowerCase().replace(' ', '-');
    					
    					if (decodedHash == target){
    						$(button).trigger('click');
    						return false;
    					}
    					
    				});
    			}
    		});
    	})(jQuery);
    	</script><?php	
    }

    If you really want, you can add a try-catch around the decode call.

  • I’ve written a really nice script that lets you copy a field name just by clicking on it, or just by clicking on the field label on edit page/posts pages.

    https://github.com/ncamaa/acf-copy-field-name

    https://imgur.com/a/dfZ5IDQ

Viewing 2 posts - 1 through 2 (of 2 total)