Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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 = '

       // TEMPLATE FOR MY PAGE

       ';
    }

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

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.