Right now I have this code to add some changes in my WYSIWYG editor in admin:

add_filter( 'default_content', 'custom_editor_content' );
function custom_editor_content( $content ) {

    global $current_screen;

    if ( $current_screen->post_type == 'page') {
       $content = '



    return $content;

But it's for all pages. I want it only for a page with id = 28. How to do that?

I guess I need to change my if condition to something like:

if ( $current_screen->post_type == 'page' && ??? post_id == '28' ??? )

However, I need to figure out the code between the question marks.

  • 4
    default_content only runs on post-new.php, I presume if you know the page's ID then the page already exists, so that filter won't be applied.
    – Milo
    Sep 14, 2013 at 18:37
  • @Milo so what should I replace it with?
    – Derfder
    Sep 14, 2013 at 18:42
  • 1
    what are you trying to accomplish exactly? do you want to replace the content of the page, or append content onto it? what is supposed to happen if someone changes the content and tries to edit the page again?
    – Milo
    Sep 14, 2013 at 18:46
  • Have a look here wordpress.stackexchange.com/questions/114111/…
    – Wyck
    Sep 14, 2013 at 18:58


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.