WordPress.org

Ready to get started?Download WordPress

Forums

Advanced Custom Fields
[resolved] how do i filter the content for wysiwyg editor?? (3 posts)

  1. guddu1315
    Inactive
    Posted 1 year ago #

    hello how do i filter the content for wysiwyg editor in AFC?

    i need to use the shortcodes for wysiwyg editor in AFC...
    how can i do that.... any one can help me?

    thank you in advance

    http://wordpress.org/extend/plugins/advanced-custom-fields/

  2. guddu1315
    Inactive
    Posted 1 year ago #

    got the solution
    write this in your FUNCTION.php

    function my_acf_format_value_for_api($value, $post_id, $field){
    	return str_replace( ']]>', ']]>', apply_filters( 'the_content', $value) );
    }
    function my_on_init(){
    	if(!is_admin()){
    		add_filter('acf/format_value_for_api/type=wysiwyg', 'my_acf_format_value_for_api', 10, 3);
    	}
    }
    add_action('init', 'my_on_init');
  3. semblance_er
    Member
    Posted 4 months ago #

    Yeah... the issue I picked up is that you can not remove any tag formatting around shortcode in the ACF wysiwyg editor. Then a shortcode won't work.

    @guddu1315 - thanks for your filter!!! It sure did the trick for me!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic