[wp-trac] [WordPress Trac] #24457: add_filter('gettext' ignores get_post_type after deleting a featured image

WordPress Trac noreply at wordpress.org
Wed May 29 22:08:41 UTC 2013


#24457: add_filter('gettext' ignores get_post_type after deleting a featured image
--------------------------+-----------------------------
 Reporter:  vmodha        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 Steps to reproduce:

 1. register a custom post type using 'register_post_type', in the example
 my post type is 'gorilla_residents'.

 2. use the following code to filter the 'Set featured image' text for a
 specific post_type:

 {{{
 function change_featuredimage_txt($translated) {
     global $post;

     if (get_post_type($post) == 'gorilla_residents') {
         $translated = str_ireplace('Set featured image', 'Set Gorilla
 Avatar', $translated);
         $translated = str_ireplace('Featured Image', 'Gorilla Avatar',
 $translated);
         $translated = str_ireplace('Remove featured image', 'Remove
 Gorilla Avatar', $translated);

     }

     return $translated;
 }
 add_filter('gettext', 'change_featuredimage_txt');
 }}}

 3. In the admin, create a new instance of the post type, e.g. a Resident.

 4. Asign a featured image. NOTE: the correct filtered text is displayed.

 5. Remove/Delete the featured image.
 NOTE: the incorrect featured image text is displayed.

 It looks as though the add_filter('gettext' ... function in my
 functions.php is being ignored after the ajax delete featured image
 function is called.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/24457>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list