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

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

Fixed! I changed the a field type and changed the query conditions.

Related Posts:

  1. Query all posts where a meta key does not exist
  2. Meta query with boolean true/false value
  3. Get post with multiple meta keys and value
  4. How to check if I’m on a custom post type archive in the admin area
  5. How Do I Use WP_Query to Run This Database Query as Search Result?
  6. Can’t sort order of wp_query with 2 meta keys
  7. Query for posts from any post type but only add instock products
  8. WP-Admin edit.php & post.php slowdown after import of 10k users
  9. WordPress Orderby Numeric Value Not Working
  10. orderby in custom WP Query does not work
  11. Unable to retrieve any posts of CPT in wp-admin
  12. Display custom post type from dynamic custom field
  13. WordPress request fiter order by related post’s post_title
  14. Custom WP_Query doesn’t display all posts
  15. Displaying a div from an assigned meta_value when on a page
  16. How to get specific post meta by title or id
  17. $post->post_meta not pulling any post in wordpress/php
  18. WP_Query of custom post type sorted by meta_key has unexpected results
  19. Returning a custom content types with meta values
  20. WP_Meta_Query object with conditionals
  21. How to retrive Custom Post Type Meta Fields in Custom WP_Query
  22. Hide title field of selected post-types on edit pages
  23. WP Admin Dropdown List Filter for custom (ACF) field on custom post type(s)
  24. Sort custom post column by generated value?
  25. Use WP_query to match post types based on custom field values
  26. How to sort by multiple values in a nested WP_Query
  27. Custom meta fields not showing up in WP_Response Object via custom endpoint
  28. How do I create a customised table list of a custom post type (in the admin area)?
  29. How to get post by meta value
  30. How do I get all authors posts of a custom post type outside loop
  31. Custom post meta box as a sub form
  32. Linking posts together with Advanced Custom Fields “both ways”
  33. How to get Current week and current date record wp query
  34. How to get post meta for custom post type and taxonomy
  35. get_post_meta for Custom Post Type ( CPT )
  36. Edit is changing my custom’s post type parent id
  37. WordPress custom post type
  38. Custom Post Type meta oembed html output resulting in WSoD
  39. Values inside a custom field to determine which category posts to display
  40. Querying meta values within an array
  41. Quering a post object based on another related post object
  42. Pagination : How to remove /page/x/ after a ‘POST’ action on a form returning to page 1
  43. Can I create a loop with multiple post types and specify different $args for each post type?
  44. How to show CPTs in term archive
  45. Query custom post type by category slug
  46. Combining sorted and random CPT
  47. How to add post_type=value when editing that post type in the WordPress admin?
  48. Insert Multiple Post with Same Publish Button
  49. Display CPT posts based on specific taxonomy
  50. Admin not showing all custom post type posts and views not working
  51. How to avoid manage posts screen duplicates when two plugins use the same library
  52. Update CPT post meta with update_post_meta and cron job
  53. Can’t query tag and post_type at the same time
  54. Setting proper query for multiple custom admin filters
  55. Custom meta box data array: foreach not working correctly?
  56. Undefined Variable – Custom Post Type Meta
  57. shortcode to show custom post types by category
  58. WP_Query: include custom post type only with specific meta value
  59. Pagination on a custom post type loop
  60. Ordering posts in Search & taxonomy by post_meta
  61. showing custom post types of a certain category only
  62. Display post meta on edit page in admin
  63. Insert post metadata for all posts in CPT at once if metadata no existent
  64. WP_Query orderby modified to include custom meta changes
  65. WordPress custom loop filter by meta_key and value with serialize data
  66. Returning a list of custom post types excluding those without a specific meta_value
  67. query private custom post type
  68. Query/list all terms and their custom post count
  69. Linking to the most recent post in a Custom Post Type
  70. Show the same Article Available in Other Categories
  71. how to delete all users and posts based on ‘user_meta’?
  72. Modify action buttons for custom post type
  73. How to make sure content doesn’t display if selection is empty
  74. Filtering WP_Query Dynamically on the Front-End
  75. Populate dropdown from one custom post type inside another custom post type
  76. Show one item per category of a custom post type
  77. Why get_posts() not returning only selected category posts from Custom Post Type?
  78. Storing posts from query and accessing later via AJAX call
  79. Two near-identical custom field types – one works, the other doesn’t . What can cause this?
  80. Meta Key Value in current-user-only loop
  81. Archive for custom taxonomy lists all posts instead of current taxonomy
  82. Genesis filterable portfolio isotope [closed]
  83. Query custom post type with tags
  84. How to check if user meta field is empty in conditional else statement
  85. wp_query check if integer exists in custom field’s array
  86. How to set YouTube video as featured image?
  87. convert custom query to wp_query
  88. Wrong request query on cpt and tax
  89. Notice: Undefined index: error and understanding wordpress
  90. Previous/Next Link by Meta Value in CPT
  91. Admin Pointers on a custom post type
  92. Show custom post type filtered by category
  93. Randomize Posts. Skip the first post in ascending order
  94. Creating a navigation menu of all posts of a custom post type and their children posts?
  95. Get custom taxonomies from multiple posts
  96. Custom Post Types. Are there any disadvantages/advantages in using a plugin to develop them?
  97. Pagination for Custom Taxonomy Page [duplicate]
  98. Filtering WP_Query
  99. Get posts between custom dates
  100. Search / Filter posts on Title/Content OR Tags
Categories custom-post-types Tags custom-post-types, post-meta, wp-admin, wp-query
REST API – Allow /users endpoint depending on a custom capability
WordPress React re-rendering to many times

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