To check if a string is a registered post_type in WordPress, you can use the post_type_exists() function. It checks if the specified post type is registered.
Example code:
$post_type = 'your_custom_post_type'; // Replace with your post type string
if ( post_type_exists( $post_type ) ) {
echo "Post type is registered!";
} else {
echo "Post type does not exist.";
}
The post_type_exists() function returns true if the specified post type exists and false if it does not.