WordPress.org

Ready to get started?Download WordPress

Forums

redirecting to new page after publishing the post (2 posts)

  1. anstrangel0ver
    Member
    Posted 1 year ago #

    hi everyone,

    i have no idea how can i redirect to some page after publishing the post.
    Basically what i am trying to do is. i have created a plugin to make multiple post when selecting to multiple category. it actually created different multiple post when selected to multiple category and now after created the multiple post i want to list those post with ability to edit the custom meta of the post.

    her e is the code m using

    add_action('publish_post', 'id_publish_hook');
    
    function id_publish_hook($post_ID) {
    // running some query her
    
    // trigeting the function
    wp_custom_listby_kds($count);
    }
    function wp_custom_listby_kds($no){
    //here i want to created a page and redirect to that admin page with the value $no
    }

    any help will be appreciate thanks in advance

  2. bcworkz
    Member
    Posted 1 year ago #

    One normally would use wp_redirect() to go to another page, but like the PHP variant, it has a rather restrictive requirement that it be called before any page data (even header info) is sent to the client. I don't know if it will work from the publish_post action or not, but it's the first thing to try.

    If it does not work, I'm not sure what's next, other than it would probably involve some sort of javascript solution.

Topic Closed

This topic has been closed to new replies.

About this Topic