Edit:
I tried to use a Code Snippet:
I copied the code snippet from here and ensured that ‘my_post-type’ was changed to my SCF “Post Type Key” setting. The same result as above – when I copied the custom Post URL into a browser where I was not logged in with WordPress, I could see the post.
function force_type_private($post)
{
if ($post['post_type'] == 'my_post_type') // I used my SCF "Post Type Key"
$post['post_status'] = 'private';
return $post;
}
add_filter('wp_insert_post_data', 'force_type_private');
I used WP functionality — Private (it worked):
I went to WP Dashboard > find the specific custom post > Edit > Set Status = ‘Private’ . This worked
Question 1:
But I’m worried someone creates a new custom post, and they forget to set it to private. I would like use a code snippet so that ALL instances of this custom post type are always private. Is this possible?
Question 2:
And if not through a code snippet, through SCF settings? (I’m not using a Field Group, just Custom Post).
-
This reply was modified 1 year, 5 months ago by
Michelle.
-
This reply was modified 1 year, 5 months ago by
Michelle.
Hi @michellepace!
ACF Support Team here. This forum is generally used by ACF users to help each other out.
However, we would love to continue investigating and troubleshooting this issue, please can you create a ticket using our support form and we can look into it further.