Skip to content

Instantly share code, notes, and snippets.

@martijn94
Created April 13, 2016 20:43
Show Gist options
  • Save martijn94/a2b5b62630195e15b22507df68fb4f10 to your computer and use it in GitHub Desktop.
Save martijn94/a2b5b62630195e15b22507df68fb4f10 to your computer and use it in GitHub Desktop.
Snippet to remove post editor and add a notice to a wordpress page
<?php
//======================================================================
// Add notice to the profile edit page
//======================================================================
add_action( 'admin_notices', 'ecs_add_post_notice' );
function ecs_add_post_notice() {
global $post;
if( isset( $post->post_name ) && ( $post->post_name == 'edit-profile' ) ) {
/* Add a notice to the edit page */
add_action( 'edit_form_after_title', 'ecs_add_page_notice', 1 );
/* Remove the WYSIWYG editor */
remove_post_type_support( 'page', 'editor' );
}
}
function ecs_add_page_notice() {
echo '<div class="notice notice-warning inline"><p>' . __( 'You are currently editing the profile edit page. Do not edit the title or slug of this page!', 'textdomain' ) . '</p></div>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment