Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

heelo, I want to use this great hook edit_form_after_title

it was announced on December 1, 2012:

it curreclty hook for : post-new, post, page-new, page.

how do I make it to work only in edit page/post (only post, page)

thanks all

share|improve this question

3 Answers 3

up vote 2 down vote accepted

Personally I'd used a differebt approach, because @Shazzad solution seems to much global dependent, and @s_ha_dum need 2 hooks instead of one.

I'd used get_current_screen function to get a WP_Screen object, then I'd looked at its property to run or not something after title:

function do_something_after_title() {
  $scr = get_current_screen();
  if ( ($scr->base !== 'post' && $scr->base !== 'page') || $scr->action === 'add' )
  echo '<h2>After title only for post or page edit screen</h2>';

share|improve this answer
Great thanks much – DrMosko Dec 29 '13 at 17:13

Don't know if there was any change during the time that passed from the original question but as of 4.0 (and probably before) you get the post as a parameter to the hook and all that is needed to do is to check the post type (if you wander what happens when creating a new post the answer is that wordpress generates a dummy post if the post type set to the correct type)

function do_something_after_title($post) {
  if ($post->post_type!== 'post' && $post->post_type !== 'page')
  echo '<h2>After title only for post or page edit screen</h2>';

share|improve this answer

Check post type using $typenow and $pagenow global variables.

add_action( 'edit_form_after_title', 'myprefix_edit_form_after_title' );
function myprefix_edit_form_after_title()
    global $typenow, $pagenow;
    if( in_array($typenow, array('post', 'page') ) && $pagenow == 'post.php' )
        echo '<h2>This is edit_form_after_title!</h2>';
share|improve this answer

Your Answer


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.