Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1024351

    Hi,

    I’m trying to change the status of Portfolio Entry from Published to Draft but get an error.
    My code:
    $args = array( ‘ID’ => $post_id, ‘post_status’ => ‘draft’);
    wp_update_post( $args );
    Error:
    The post type portfolio is not registered, so it may not be reliable to check the capability “edit_post” against a post of that type.

    What have I missed?

    Thanks, Nick

    #1024934

    Hey Nick,

    Can you tell us where you applied this (name of the file and location)?
    Also please post the whole code in https://pastebin.com/ and post the link here so we can check the code.

    Best regards,
    Nikko

    #1025020

    The code is in a function that’s called by a CRON job every night. It checks the status of each user and then changes the status of the Portfolio:

    https://pastebin.com/B2Pwdh7V

    Regards, Nick

    #1025424

    Hi Nick,

    I’m not really sure how to test that.
    But I am sure that portfolio is registered, you can check this in enfold > includes > admin > register-portfolio.php (version 4.5) line 47:

    register_post_type( 'portfolio' , $args );

    Best regards,
    Nikko

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.