According to the devs at WP (https://core.trac.wordpress.org/ticket/39164):
“This was an intentional change to get_post() in 4.7 – passing an invalid parameter may have previously returned a result, but it could’ve been an incorrect resource, for example, a value being cast to a numeric 1 and fetching from the incorrect post.
get_post( 123 ) is the same as get_post( ‘123’ ) but not the same as get_post( ” 123 ” ) (Which now fails) IMHO, so I agree with the change, especially in this case.”
So I would consider this the definitive answer. The behavior has changed to something better, it was just a surprise that it worked before.
Related Posts:
- Get list of all registered post types slugs
- tag.php doesn’t work with tags on a custom post type post?
- How to build a complex page structure
- Proper way of making custom post type landing page or archive page
- If featured image doesn’t exist, show post content
- Getting a div content of a post in wordpress?
- Rename a current used post type
- Include custom post types in categories widget
- Pagination gives 404 error
- add_meta_box: Datepicker like the one for postdate?
- How do you use JavaScript to detect the homepage
- Custom field losing p tags on display
- I am trying to output portfolio items with a picture. This code doesn’t seem to be working. What am I doing wrong?
- How to customize admin posts based on the user who is logged in
- Custom post type – how can I make it a sub-url of another page?
- Custom post type ‘orderby’ => ‘meta_value’ not working
- Should I use custom taxonomy or custom post type
- Loading custom post thumbnail into stream
- Custom Post Type doesn’t show Draft and Trash Options
- How to query_post custom posts within default taxonomy?
- the_content() not outputting anything (Advanced Custom Fields)
- Change custom post type slug from plugin options
- How to use has_archive but disable feed per post type?
- Custom Taxonomy back-end customizations
- WordPress CMS Inquiry
- Custom rewrite url category
- Static apple-app-site-association file with wordpress
- Edit the author of custom post type
- Is it possible to have a custom post type with feed but without the archive?
- Custom bulk_action
- How to: wordpress job listing and candidates details
- Add parent post to Custom Post Type [closed]
- Hide if Custom Post Type is empty
- Show ACF to front end custom post [closed]
- What’s the name of the custom post type yearly archive template?
- Combine multiple getEntityRecords calls
- Custom URLs in post types make it impossible to view archive
- How to add and clear custom post types and taxonomies in a plugin? Considerations for existing data
- Permalink problems with custom post type and custom taxonomy
- Adding Multiple Post Types to Query [duplicate]
- Custom Post Type Categories URL not displaying posts
- Custom order of Taxonomy Terms
- Custom post type subtaxonomy template
- tax_query (if the terms are empty)
- Getting only one post per category
- passing values from functions.php to template
- How I can made a custom post type to page templates?
- Running a custom query inside another cpt single and trying to grab a variable
- trying to show single post but displays all post on a custom post type
- List all posts in taxonomy term
- insert image with custom post type
- Query all post types but limit to parents
- get post count for related author
- Create list from custom field comma separated values
- What’s an easy way of sorting custom post types manually?
- How to fix the Post Preview Button (CPT & map_meta_cap)
- Fetch data from two custom post types and create multidimensional array for output to html table
- Restrict Custom Post Type per role in Dashboard
- Create a Dropdown Selector and Redirect for a Custom Taxonomy in WordPress?
- How to Implement Search Functionality?
- Adding /blog in front of single posts (only)
- Query filter by value in meta_value array
- wp rest api orderby field in a custom table
- Expire post to draft by date-picker custom field
- Edit the default ‘post’ custom post type arguments
- Post template with breadcrumb needs to show page navigated from
- Publishing failed. The response is not a valid JSON response
- add all blog posts to folder
- ‘Simple’ Reservation System
- Custom post type, next and previous links by page title
- Reading Custom Post data so I can have user update Manually
- Custom post types – meta_query: search lesson which starts sooner
- Saving custom post types post_meta over REST-API fails
- Custom Post type plugin is using theme single.php and style.css
- WordPress Custom Post Type – Post Attribute: Template. Template shows up and saves on the back end, but the default theme file is being rendered
- Most efficient way of showing children posts?
- Capabilities and mapping required for a role to be able to edit other’s posts of a custom type, BUT only be able to edit their own blog posts
- Permalink Problem with Custom Post Type
- Automatically convert standard posts with custom fields to custom post types
- How To Display Category list from Portfolio post type plugin?
- Custom Post Type tag taxonomy “Page Not Found”
- Remove custom post type slug but keep related category taxonomy permalink
- Adding CPT changes entire layout of my site except for the archive of that CPT
- page not found for example.com/custom-post-name
- How to show Y number of custom posts after every X normal posts?
- custom fields not showing before get_header
- Why is my custom post type shown in the wrong place?
- Display Custom Post if custom field is marked
- Custom post type category page not working
- Turn off comments for given CPT checkbox?
- Categories in custom post types
- List a custom post type’s posts ordered by nested custom taxonomy
- listing custom post type category page
- Inserting random posts
- Allow authors to create article image
- Rewrite a filter as shortcode (or something like that) to use anywhere in CPT
- How to delete unnecessary custom post types in the UI
- Two pagination in one page without AJAX
- I want to show a list of post with title that have link goes to that post and icon under the specific category to which it belongs
- Show a wordpress custom post condtionally using a category term