Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Warn users not to edit the post container
// Add to functions.php or place in mu-plugins
// Admin Notice on Posts Page
add_action( 'admin_notices', 'scl_postspage_print_notices' );
function scl_postspage_print_notices() {
$screen = get_current_screen();
if ( $screen->parent_base != 'edit' || $screen->base != 'post' || $_REQUEST['action'] != 'edit' )
$posts_page = get_option( 'page_for_posts' );
if ( !$posts_page )
if ( $_REQUEST['post'] == $posts_page )
echo '<div class="error"><p>This page is a container for the most recent posts. It should always be empty, and you should never edit this page. To add a news item, go to <a href="post-new.php">Posts -- Add New</a>.<p></div>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.