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.

I know there are a lot of hooks in WP for altering a posts content (and other fields) before the post is written to the DB upon saving; but what I am interested in doing is running my custom filter before the post is loaded for editing. So basically when my custom post type is loaded by /wp-admin/post.php?post=##&action=edit, I would like to run my filter on it before the content is displayed in the WYSIWYG editor. Is that possible or no?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

You can use the the_editor_content filter:

function wpa_editor_content( $content ) {
    global $post;
    return "this post's id is $post->ID " . $content;
}
add_filter( 'the_editor_content', 'wpa_editor_content' );
share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.