0

I have a custom post type that uses an alternative comments template. I modified the comments template for my custom post type to function like a five star review system.

Is there a way I can change the "Allow comments" on the edit screen for my custom post type to read "Allow reviews"?

screenshot of edit screen for custom post type

0

You can fire filter hook gettext ( example available too ) to change default text Allow comments. in admin edit screen. Here another sample function:

add_filter( 'gettext','wpse221235_change_admin_cpt_text_filter', 1, 3 );
function wpse221235_change_admin_cpt_text_filter( $translated_text, $text, $domain )
{
    global $typenow;

    if ( is_admin() && 'Allow comments.' == $text && 'your-post-type' == $typenow )
        $translated_text = __( 'Allow reviews.', 'text_domain' );

    return $translated_text;
}

Of course, thanks @Sumit for point out, those sample just give the OP the direction, the same approach with WordPress example. If we need a more generic approach, please visit @toscho answer, there are a lot of discussion about it, and we can figure out the good approach to change text translation.

  • I think is_admin() and $typenow should be checked before adding the action! This filter will be active everywhere now! – Sumit Mar 21 '16 at 6:06
  • @paul-coppock you're welcome. Good luck with your project. – Jevuska Mar 21 '16 at 12:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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