[wp-trac] [WordPress Trac] #46355: get_page_by_title() doesnt work if title has an apostrophe ( ‘ )

WordPress Trac noreply at wordpress.org
Wed Feb 27 04:25:57 UTC 2019


#46355: get_page_by_title() doesnt work if title has an apostrophe ( ‘ )
-------------------------------+-----------------------------
 Reporter:  WPnerdzz           |      Owner:  (none)
     Type:  defect (bug)       |     Status:  new
 Priority:  normal             |  Milestone:  Awaiting Review
Component:  Posts, Post Types  |    Version:  5.1
 Severity:  normal             |   Keywords:  needs-patch
  Focuses:  coding-standards   |
-------------------------------+-----------------------------
 Here is the code in my theme.

 {{{
 $lz_version= get_post_meta( $post->ID, 'option_current-release', true );
 }}}

 a metabox with a number like 1.9. Custom Post type: Books

 {{{
 $lz_name = get_the_title().' - '.$lz_version;
 }}}

 it echos something like "Alex’s book collection – 1.9"

 {{{
 $lz_links = get_page_by_title($lz_name, OBJECT, 'release_link');
 }}}

 release_link is a custom post type. The titles of that CPT are like
 “Alex’s book collection – 1.9”

 {{{
 echo get_the_title($lz_links>ID);
 }}}

 it echos the title of current page “Alex’s book collection”, not desired
 “Alex’s book collection – 1.9”
 But if I dont add any apostrophe, the code works fine.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46355>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list