Support » Plugins » content_save_pre filter run twice?

  • The function which registered in content_save_pre filter will run twice when saving or publising post, why?

    code sample:

    function wp_a_little_test($content)
        static $num;
        if ($num > 0) {
            exit('Yes, the function run twice!');
        return $content;

Viewing 4 replies - 1 through 4 (of 4 total)
  • Anybody know?

    I’m facing the same problem.
    Is there any solution available?

    Me too. I just got round it by keeping a counter as in the example above and ignoring everything after the first one. But why – I don’t know.

    I had this problem too..

    I got around it like this:

    add_filter(‘content_save_pre’, ‘foo’);

    function foo($content) {

    //won’t let it happen again
    remove_filter(‘content_save_pre’, ‘foo’);

    return $content;

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘content_save_pre filter run twice?’ is closed to new replies.