WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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 '13 at 18:37
@Milo so what should I replace it with? – Derfder Sep 14 '13 at 18:42
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 '13 at 18:46
Have a look here wordpress.stackexchange.com/questions/114111/… – Wyck Sep 14 '13 at 18:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.