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
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
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:
Regards, Nick
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