Forums

[resolved] Rewrite text in new post then added - what hook? (1 post)

  1. 3dom
    Member
    Posted 2 years ago #

    I need to force plugin to rewrite text in all new posts and to save these changes in database. Something like

    function rewriter($post) {
    $post .= " - some text added";
    $post = str_replace('word','replacement',$post);
    return $post;
    }

    I've tried hooks like
    add_action('the_content', 'rewriter', 0);
    add_action( "save_post", "rewriter",100,1);

    didn't work for me. What hooks to use in this case?

    (add_filter is not the case because rewriter() actually has tremendous amount of code + connections to remote servers)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags