Private Notes Post Type Snippet

Tech Articles | May 20, 2025 | Blog, Coding, Wordpress

On this website and several others, I use a hidden post type called note(s) to store private notes usually linked directly to blog posts or tutorials, as well as modifications I make to plugins and site setups.

I achieve this by making the custom post type and then making that note type private using the following snippet.

function set_default_status_for_new_note_posts($post_id, $post, $update) {
    // Check if the saved post is of the 'note' post type and it's a new post (not an update)
    if ('note' === $post->post_type && !$update) {
        // Update the post status to 'private'
        wp_update_post(array('ID' => $post_id, 'post_status' => 'private'));
    }
}

add_action('save_post', 'set_default_status_for_new_note_posts', 10, 3);
PHP

The reason I’ve done it this way rather than use a notes plugin is because its reasonably secure and in addition WordPress native so other than my snippet above its all native and easy to extract, export and backup.

Support the Author

buy me a coffee
Really Useful Plugin Logo
Wpvideobank temp
Appoligies for any spelling and grammer issue. As a dyslexic i need to rely on tools for this they like me are not perfect but I do try my best