Support

Account

Forum Replies Created

  • Hey @rasso et al., I know this is several years old now, but I just had this problem, and this thread helped me solve it.

    But.

    There was one thing missing that I had to learn the hard way.

    meta-box-order_custom_post_type

    …should be…

    meta-box-order_[YOUR custom_post_type SLUG HERE]

    So, in my case…

    meta-box-order_communities

    When we add in @tdmalone’s helpful addition, the full code becomes…

    
    function prefix_reset_metabox_positions(){
      delete_user_meta( wp_get_current_user()->ID, 'meta-box-order_post' );
      delete_user_meta( wp_get_current_user()->ID, 'meta-box-order_page' );
      delete_user_meta( wp_get_current_user()->ID, 'meta-box-order_YOUR_CPT_SLUG' );
    }
    add_action( 'admin_init', 'prefix_reset_metabox_positions' );
    
  • Hi @tebbott: Could you help me adapt this function? I want to apply it to a slightly different scenario, but my regex chops aren’t good enough:

    function filter_ptags_on_acf_images($acfcontent){
    		return preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(\/a>)?\s*<\/p>/iU', '\1\2\3', $acfcontent);
    	}
    	add_filter('acf_the_content', 'filter_ptags_on_images');

    Function output:

    <a href="#"><div>
    </div></a>

    Generated markup:

    <a href="#"><div>
    </div><p></a>

    How can I strip out that annoying p tag?

    I’m also using a version of the wpex_clean_shortcodes() function listed above. It works well for some scenarios but it’s not helpful here. Can your regex function help me?

  • Hi all, a year and a half later, I’m weighing in to add one bit of advice that worked for me:

    I kept getting </div></p> and similar phantom paragraph tags whenever I used shortcodes in an ACF WYSIWYG field. I extended @jt-mtl’s add_filter solution a bit and it worked for me.

    $array = array (
        '<p>[' => '[',
        ']</p>' => ']',
        ']<br />' => ']',
        '<p><div' => '[',
        '</div></p>' => ']',
        '</div><br />' => ']'
    );

    You could add any other markup to the array if you want to. Divs were all I needed, so I stopped there. Hope it helps!

  • I have the same problem. When I do a var_dump, I get nothing:

    var_dump(get_field("test")); returns bool(false)

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