Support

Account

Forum Replies Created

  • @killianleroux a couple things:

    1. There’s a space in one of your constants:

    $mainMedia[ACF_ID_COMPANY_IDENTITY_MAIN_ILLU_MEDIA_ TYPE]

    If you haven’t already, you might consider setting WP_DEBUG_LOG to true and checking debug.log when running this.

    2. Revision checks

    Not sure if this will help and I don’t know the full scope of what you’re doing but regarding your remove_action('post_updated', 'wp_save_post_revision'); step, if you’re not familiar you might find these guard clauses helpful, which can be run on the save_post filter (and probably others) if you’ve got a post revisions-related conflict going on:

    	
    if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) {
    	return $post_id;
    }
    
    if ( wp_is_post_revision($post_id) ) {
    	return $post_id;
    }
    
  • 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');
    
  • This could help: https://support.advancedcustomfields.com/forums/topic/wpml-get-field-from-options-from-specific-all-languages/#post-82538

    If not: if French is the default language, you could try modifying the example from this comment to work with page-level fields instead of global options, and rename it from get_global_option() to get_french_field() or something to that effect. If French isn’t the default language, you’d probably just need to modify the output of cl_acf_set_language().

  • +1. If @elliot is concerned about security of storing one’s license key in the filesystem, here are some other ideas:

    Idea 1: Check site authorization remotely–no license key required after the first time. I think this would probably go hand-in-hand with letting folks authorize a site from advancedcustomfields.com (not just de-authorize). WPML does it that way. This also seems to be how Admin Columns Pro does it, since I never need to re-authorize that one after copying from one site to another, as long as I’ve authorized it once on that domain. If I remember correctly, I think WooCommerce extensions (and maybe WC itself) also takes that approach.

    Idea 2: Allow us to generate & hard-code site-specific auth tokens instead of the master license key. I don’t know what security issues @elliot is concerned about specifically (maybe that people’s license keys will start showing up on Github?) so maybe this is worthless, but if it helps get ideas going, perhaps there could be something similar to ACF’s current method of combining the license key and domain together, but instead of base64 it uses some kind of hashing algorithm. (On the other hand, perhaps doing that securely would entail the same logic/development required by idea 1 without any additional benefit?)

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