WordPress.org

Ready to get started?Download WordPress

Forums

JSON API
How to get post without html tags? (4 posts)

  1. jecky
    Member
    Posted 1 year ago #

    How can i get the post details without html tags?

    Is there anything plugin supports for that?

    If i want to apply filter like $content = apply_filters('the_content', $content); where should I add?

    http://wordpress.org/extend/plugins/json-api/

  2. Rommel Castro
    Member
    Posted 1 year ago #

    you can clean up the response! with javascript: Strip HTML Tags in JavaScript

  3. dphiffer
    Member
    Plugin Author

    Posted 1 year ago #

    Hi jecky, if you want to do this on the server side, you could add an action handler for the post constructor like this:

    add_action('json_api_post_constructor', 'strip_json_post_html');

    function strip_json_post_html($post) {
    $post->content = strip_tags($post->content);
    $post->excerpt = strip_tags($post->excerpt);
    }

  4. drg1599
    Member
    Posted 9 months ago #

    Hi dphiffer,
    The above is not working for me, what should i do?
    i added that in my functions.php , isn't that right?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic