The MU forums have moved to WordPress.org

Actions after published post to get ID (5 posts)

  1. bloggus
    Member
    Posted 16 years ago #

    If I want to get a ID of the blog and ID of the post, can I get it with publish_post or save_post or should I use another action?

  2. cafespain
    Member
    Posted 16 years ago #

    Use save_post:

    add_action('save_post', 'post_handle_save', 9 , 2);

    Which passes in two arguments the post_id and an object containing the posts details.

    You will have to use a function call to get the blog_id though (or can blog_id be called with as a global variable now???) - not 100% on that one, so you might have to investigate or some other more knowledgeable person might reply below.

  3. bloggus
    Member
    Posted 16 years ago #

    Thanks for trying cafespain. Anybody else have suggestions?

  4. cafespain
    Member
    Posted 16 years ago #

    You mean you tried it and it didn't work?
    Worked fine for me on the Vent plugin.

    You can get the blogid by declaring:

    global $blog_id;

    at the top of the called function.

  5. bloggus
    Member
    Posted 16 years ago #

    I will try it again. I made some stupid misstake probably ...

About this Topic