Take 2 on my answer:
get_the_title uses the the_title filter, which turns your apostrophe into a right single quotation mark. When you then plug the resulting string into get_page_by_title, you don’t get a match – because ’ is not the same as '.
So, bypass the_title filter completely:
$post = get_post( $extraPostID );
$extraContent = get_page_by_title( $post->post_title, OBJECT, 'post' );
Related Posts:
- Browser title script ignoring is_page /else conditional [closed]
- WordPress from url get external source title
- REQUIRED: get_bloginfo(‘template_url’) was found in the file search.php. Use get_template_directory_uri() instead
- Can’t put a hyperlink on Featured Post’s Image
- Rewriting to a different page based on existence of query string?
- Redirect users not logged in to the standard login page (and back) from some posts and pages
- if is specific custom post in cpt
- Error Warning: Declaration of description_walker::start_el after PHP upgrade [duplicate]
- How to use nonce with front end submission form?
- Autoloading in Child Theme
- WSOD but WP_DEBUG not giving any errors
- How to export/import theme customizer settings?
- How to loop through JSON data in wordpress WP REST API
- Rename image uploads replacing “width” and “height” in filename with “medium”, “large”, “small”
- Drop down+sort blog posts date added/most popular
- How to remove “out of stock” variation options from size dropdown in woocommerce?
- WordPress Customizer: How can you have multiple active callbacks on one control?
- Looking for a better way to handle an ajax script that pulls in post data on click
- add_rewrite_rule with bottom priority doesn’t handle the WordPress pages
- Adding featured image via PHP
- wordpress custom endpoint multiple params
- Enable errors PHP WordPress 5.2
- How to set status codes such as 401 and 403?
- Minify HTML, CSS, JS with PHPWee?
- Show Custom Taxonomy Title
- How do themes render caption texts in extended markup (e.g. “wp-caption” paragraphs)
- WordPress widget/sidebar dividers?
- Add custom php database code above
- PHP code inside shortcodes
- Help with some php math in WordPress
- max_input_vars: how many am I using?
- Multiple WordPress Menus that will only display all pages
- Latest post in a specific menu
- WordPress not reflecting changed of the database
- Woocommerce related product text
- how to combine wordpress htaccess on my root domain + php on subfolder
- WordPress, AJAX and pre_get_posts using conditional tags
- Input data from email form not going to JSON file
- Two menus show up
- How to determine if the sidebar is empty? Or not active?
- How to display login form anywhere, when user isn’t logged in, without redirecting?
- How to create pagination for users list using custom array?
- WordPress member notification
- Unset session variable on page reload / setup but exclude AJAX
- get_posts works in the page template but not in a shortcode
- Create page with custom php script and fetched data
- How to show an entire post content and not also the excerpt?
- WordPress shortcode returns the data before
- One account with multiple logins
- How can get all users by current user meta?
- Sort posts in a specific way
- How to hide post in WordPress
- Only show posts from the last trailing 12 months
- `update_post_meta` not working anymore
- Custom pagination (Previous / Next)
- using wp enqueue style to create a CSS file specifically for a page template
- Getting the slug into a variable, how to echo that variable
- The user can only see their own profile
- Hide a div when a custom field is empty
- Post meta select input, if statement
- Fatal Error wp-settings.php on line 119
- what does $options = get_option(‘test_theme’); do?
- Set document title through shortcode plugin
- Adding a custom meta field with default NULL value which is not selectable
- WordPress url By country code?
- How to change basename url for wp-admin?
- Prevent header and footer from loading on specific pages with template or plugin
- Get taxonomy terms that share a common object property
- My Custom Post Type AJAX Query is Returning no posts – why?
- WordPress all php BUT index.php downloads instead of loads
- Don’t update modified post date when user add a product review or comment?
- Mysterious letters appearing at the top of a few pages
- Trouble matching strings (titles) using wp_query
- Current WordPress Page Title as Search Parameter into A Tag
- Limit the number of characters/words in an excerpt for a related posts section
- Yoast Breadcrumbs Inject Multiple Levels
- Maximum file Upload
- How to give custom roles the capability to edit one Menu instead of every Menu
- Unzip_file causing Media file upload error
- Primary navigation menu with timed items from custom post type
- Different Logo for Different Pages
- WooCommerce – Add Shipping class below each product in Shopping Cart page
- Escaping a Single Quote in str_replace for Nav Function
- Use fetch_feed(); Totally Outside of WordPress?
- SQL Query Search page
- widget: input the px value from user and use it as inline style in widget function
- Create a dynamic buddupress tab
- Problems with plugin that fetches data from database with ajax
- WordPress causing all code to be displayed on line 1. Receiving multiple errors after cleaning cookies and cache
- When I use rewind_post() it shows menu items in my loop
- How to post data to a word press site in case of a mobile app
- Customise Author Page?
- How to create categories out of a list of words?
- Pass a PHP variable (loop-audio.php) to jQuery function (js/script.js)
- Custom field fetch error on woocommerce pdf invoice
- posts_clauses drop ACF get_field function
- PHP block changed to comment by WordPress?
- WordPress @include( ‘template-config.php’ );
- Is there a hook that I can use when a fatal error occurs?
- Embed dynamic media query in a Gutenberg block