Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Do posts, pages and / or custom post type objects have unique ID numbers or can there be multiple objects with the same IDs?

The posts table, wp_posts is probably the most important table in the WordPress database but it does not contain only blog posts as its name implies. It stores various types of content including posts, pages, menu items, media attachments and any custom post types (CPT) that a site uses.

The ID column of this table is the unique number assigned to each content entry.

The table’s content nature is provided by the post_type column which denotes if the row is a post, page, attachment, nav_menu_item or another type, so none of above can be assigned the same ID by WordPress.

So unless you manually modify the database (which would be a bad move), ID‘s are unique within a blog/site.

Multisite

However, within a WordPress Multisite Network, ID‘s are not unique. A post on one site can have the same ID as a post on another site, since each sub-site has a separate database/tables.

In such case you can use $post->guid instead of $post->ID. guid means Global Unique Identifier and this is WordPress’ tool for this exact purpose, to be unique in the entire network.

NB: The guid must be in lowercaps for it to work.

Related Posts:

  1. get_post_meta not working with variable as a post_id for dynamically get the postid
  2. Check if post with same meta value exists
  3. Filter date from post meta when date is in string format
  4. Get only used meta_values
  5. If Post Meta Equals Current Title Conditional Advanced Custom Fields
  6. Is there a way to exclude posts based on meta_values?
  7. Archieve.php not loading for custom post type
  8. Submitting Custom Post Types with custom fields from Front-end form
  9. create custom meta box with default value
  10. retrieve permalinks of posts inside custom post type by using post ID
  11. Get $post->ID from a URL
  12. Displaying a div from an assigned meta_value when on a page
  13. Meta data (Tags and Categories) for Custom Posts not showing.
  14. Display different information of a custom post type
  15. Create Array from custom post type to display a slider
  16. Setting Post Title via Meta Data returns Auto-draft
  17. How to Echo Metadata Value in Currency Format
  18. Issue on Working with Metabox – Checkbox to enable Sale Items
  19. Filter posts by tax (dropdown) and meta value
  20. delete_post_meta() for whole CPT / multiple posts?
  21. How to get specific post meta by title or id
  22. Publish and save specific postmeta to a filtered post_type
  23. How to move a post to different post type with all meta data?
  24. Why do I have to press the “Update” button twice to save my meta box values?
  25. How can I display a drop-down select of Post Names
  26. how to show records that don’t have custom meta value
  27. WP API Response does not show my registered metadata
  28. How to detect that the save_post hook is calling the callback associated to the current edit post page only
  29. post_type internal ID?
  30. $post->post_meta not pulling any post in wordpress/php
  31. Values from meta-box not on $_POST
  32. WP_Query of custom post type sorted by meta_key has unexpected results
  33. Returning a custom content types with meta values
  34. Custom post type suddenly stoped working after WordPress 5 update
  35. Batch Extract Date from post title and put into ACF custom field
  36. copy images from custom field to another custom field
  37. How to show custom field on specific custom post type posts only when filled
  38. How to handle this specific case of custom post type?
  39. Save CTP post meta different values each day without overwriting previous values
  40. get_post_meta returns NULL in front-end, but correct result in back-end
  41. Cannot obtain custom meta information
  42. Problem with adding custom post type meta to header by plugin
  43. is_main_query() never called on WP 4.4
  44. How can I output WPAlchemy repeating fields meta values in my page template?
  45. Meta box data is saved but NOT displayed in the meta box text field. Why?
  46. How to call a post’s metadata in shortcode.php?
  47. Custom post type returns bad post ID
  48. Save Metabox Custom Field Value
  49. Echo custom post meta from options array
  50. Value of post meta dropdown is not showing in WordPress
  51. Meta box data not saving
  52. Get all metadata for a given custom post type
  53. WP_Meta_Query object with conditionals
  54. Trying to write shortcode with get_post_meta but isn’t working
  55. Related posts meta_query CPT
  56. Give a unique ID while saving
  57. Meta box with front-end styling
  58. Sanitaizing Select Optin For Custom Post Type Metabox in WP
  59. How can I get some of a posts meta data whilst it is still inserting?
  60. How to retrive Custom Post Type Meta Fields in Custom WP_Query
  61. Advanced custom field – posted fields from custom post type
  62. Cannot Save MetaBox Data in Custom Post Type
  63. delete duplicate meta_value with same post_id
  64. HM CMB: Post Select Field for CPT ID
  65. Search CPT Title AND Meta
  66. Getting WordPress to store 0 values for custom post type meta
  67. updating one custom meta field only
  68. Add a class to post_class if more than one post shares same meta_value_num
  69. Function to return values from metabox
  70. Add a meta field to the list of results for a custom post type
  71. best way to use custom taxonomy, post type and meta in a job system
  72. Empty meta-box returns publishdate if no value is set?
  73. Say I have a tech blog, how best would I store technical specs for a phone, if i use custom post types
  74. Building tags and archive using meta from custom post type
  75. How to order custom posts by one of the custom fields value, ‘date’?
  76. Problem Saving Custom Post Type Meta Values
  77. Use Author Ids or Names to echo different output inside loop
  78. Filter search posts by post meta?
  79. Custom Meta Box with variable number of fields
  80. Custom fields for post or terms which don’t update on post update
  81. Hide title field of selected post-types on edit pages
  82. WordPress CPT Taxonomy Dashboard Search – How to include taxonomy in search?
  83. Custom Post Type meta data getting deleted on bulk editing taxonomies
  84. Should I use a custom taxonomy or custom post type for grouping a list of panels associated with a group of tests?
  85. How to create review point system for CPTs (many-to-many relationship)
  86. After inserting new post with wp_insert_post() the post is not visble to WP_Query, but the same WP_Query works for post inserted from wp-admin panel
  87. Using publish_{custom-post-type} hook for custom post type to update meta doesn’t work
  88. Get_post_custom not fetching value from array wordpress
  89. Add a form in every post and save data in post meta
  90. How can I write a function that would update any missing specific post metadata?
  91. SELECT custom post type and its meta in SQL
  92. How to use multiple Meta Field from CPT as Post permalink
  93. Save data is post using php front end
  94. How is possible to know ID of taxonomy-{taxonomy}.php page for ACF fields
  95. Unable to gather Image URL from Custom Post Type’s; Custom Meta Field
  96. How to keep custom post type related information
  97. Custom attachment function not working in v5.4.2?
  98. Can’t save meta box data in WordPress using custom post types
  99. Creating a custom post type upon registration for a specific user role
  100. Attaching more than 1 parent (Post) to a media file
Categories custom-post-types Tags custom-post-types, id, post-meta
Is it possible to add a dynamic link in the main navigation in a child theme
Update blog option during create new blog?

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress