Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 504799

Change post status to private

$
0
0

Replies: 0

Hi,

I would like to update the post status of Flamingo posts to private so I can more securely use them with WordPress’s REST API. I have tried to do so with wp_transition_post_status but this does not seem to make a difference? Please assist.

function flamingo_inbound_status($post) {
	$post_type = get_post_type ($post);
	$old_status = $post->post_status;
	if ($post_type == 'flamingo_inbound') {
		$old_status = $post->post_status;
		wp_transition_post_status('private', $old_status, $post);
	}
}
add_action( 'transition_post_status',  'flamingo_inbound_status', 10);

Many thanks,

Costa


Viewing all articles
Browse latest Browse all 504799

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>