• Resolved dibonifacio

    (@dibonifacio)


    Hi, this plugin is great, I´m using it “manually”
    I´m trying to set a post to archived in PHP.
    Do I need to set the status to ‘Archived’ and the archived date too, right?
    Do you have a sample code to do this?

    Thanks”

    • This topic was modified 4 years, 11 months ago by dibonifacio.
Viewing 1 replies (of 1 total)
  • Plugin Author shawfactor

    (@shawfactor)

    just udate the post status like this:

    // Update post 37
    $my_post = array(
    ‘ID’ => 37,
    ‘post_status’ => ‘archive’
    );

    // Update the post into the database
    wp_update_post( $my_post );

    No need to set the archive date if you have already set the post to archived.

    All the archive date does is set the post to archive automatically once the archive date has passed.

Viewing 1 replies (of 1 total)
  • The topic ‘How to programatic set the archived status and archived date’ is closed to new replies.