• If one inserts a post using the wp_insert_post() function, passing in an associative array of ‘post_title’=>…, ‘post_content’=>…, etc. how does one control pinging? For instance disabling pinging for a single post, as opposed to using the site’s ping_sites option.

    I see a ‘to_ping’ variable, but I’m not sure how it works. By default it seems to be blank in the wp-includes/post.php wp_insert_post() function. I don’t know if that means no pinging is done by default, or if the ping_sites option is used instead.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Trahald

    (@trahald)

    Does anybody know what the ‘to_ping’ parameter is about?

    Thread Starter Trahald

    (@trahald)

    Anyone have any insight on this issue?

    Thread Starter Trahald

    (@trahald)

    Does no one know anything about this?

    Thread Starter Trahald

    (@trahald)

    Is this so obscure that no one knows anything at all…? 🙂

    So this is really really late. But I had the same problem. Ive created a plugin that imports a swedish microblog (www.bloggy.se, like twitter) into your blog. It checks an rss channel and imports all posts into a specific wordpress category. I wanted to ignore the ping (from “Update service”) with these posts. But only these posts.

    I looked like a maniac. I havent even been able to find WHERE in the WordPress codes these are sent. Haha.

    Anyway. With some luck I find what I think is a solution. By ignoring all the posts from the specific category in the feed. They are not sent by the “Update Service”. I guess the Update Service uses the xml feed when pinging.

    To skip the posts I added this (sort of, a bit edited) into my plugin:

    function myPlugin_pre_get_posts($wp_query) {
    	if ($wp_query->is_feed) {
    		$wp_query->query_vars['category__not_in'][] = $category_id_to_skip_in_feed;
    	}
    }
    add_action('pre_get_posts', 'myPlugin_pre_get_posts');
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘wp_insert_post to to_ping – controlling pinging for individual posts’ is closed to new replies.