Support

Account

Home Forums ACF PRO acf/save_post + post_meta array + shortcodes Reply To: acf/save_post + post_meta array + shortcodes

  • Hey John!

    Thanks for the reply!

    Sure, here’s my acf/save_post code:

    
    function my_post_field_array_save($post_id) {
    	if( have_rows('my_repeater',$post_id) ): 
    		while ( have_rows('my_repeater',$post_id) ) : the_row();
    			remove_filter('acf_the_content', 'wpautop');
    			// remove_filter('acf_the_content', 'do_shortcode'); Could I do something like this?
    			$my_repeater_arr['my_repeater_wysiwyg'] = htmlentities(get_sub_field('my_repeater_wysiwyg',$post_id));
    			add_filter('acf_the_content', 'wpautop');
    		endwhile;
    		update_post_meta($post_id,'my_repeater_meta',$my_repeater_arr);
    	endif;
    };
    add_action('acf/save_post', 'my_post_field_array_save', 20);
    

    Here’s the actual (raw) WYSIWYG content:

    
    [site_url]
    <a href="[site_url]">URL</a>
    

    Here’s the array (no post/save):

    
    array(1) {
      ["my_repeater_wysiwyg"]=>
      string(62) "[site_url]
    <a href="[site_url]">URL</a>"
    }
    

    Here’s the array after (i.e. serialized in the post_meta field…using the pastebin below because this ACF forum converts my HTML entities): http://pastebin.com/iZqffdq1

    Thanks in advance!

    Ryan