Support

Account

Home Forums Feature Requests Customize the "add to gallery" button label Reply To: Customize the "add to gallery" button label

  • Just chiming in here that if you want to tie your code to a field name instead of the ID (which would change if you created the field again elsewhere), you could change the selector in the example above to something like this:

    
    function my_acf_ungallery_button() {
    	?>
    <!-- Re-label ACF gallery button -->
    <script>
    (function($) {
    	window.addEventListener('DOMContentLoaded', function(){
    		$('.acf-field-gallery[data-name="your_field_name_here"] a.acf-gallery-add').text('Add to folder');
    	});
    })(jQuery);
    </script>
    <!-- / Re-label ACF gallery button -->
    	<?php
    }
    add_action('acf/input/admin_footer', 'my_acf_ungallery_button');