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

Return only custom post types for the page, not all

your main problem is

              <?php query_posts('post_type=case_studies'); if ( have_posts() ) while ( have_posts() ) : the_post(); ?>

This means if there are posts, then while there are posts, get from the current post. After processing, it will just keep iterating through the posts.

Delete this line and the end while line.

Instead, use this

<p><?php echo get_post_meta(get_the_ID(), "_Description", true); ?></p>

This gets the current id of the current post.

Having said that, please do some validation of the results you get from get_post_meta to ensure that there are results before echoing it out.

Related Posts:

  1. what is the correct way to compare dates in a WP query_posts meta_query
  2. Conditionally Query Custom Post Types by Post Meta for Blog Home Page?
  3. Display custom post type from dynamic custom field
  4. Get posts between custom dates
  5. Custom fields (wp_post_meta) vs Custom Table for large amount of data
  6. Filter date from post meta when date is in string format
  7. HM CMB: Post Select Field for CPT ID
  8. Use WP_query to match post types based on custom field values
  9. update a posts of other custom post type
  10. WordPress custom post type
  11. Custom post type archive page for multiple post types
  12. Importing Data from a Non-WordPress database, into WP
  13. Listing all term items alphabetically / sorting loop
  14. Getting thumbnails of a custom posts featured images in a page-templates metabox
  15. List Taxonomies: Don’t list taxonomy if it has no post – depending on custom post-meta?
  16. Remove Post Custom Meta Box
  17. pagination not working for category.php (custom post types in categories)
  18. Can’t publish custom post type – “You are not allowed to edit this post.”
  19. How to display Related Posts based on number of taxonomy terms matched
  20. Custom fields for custom post type
  21. Show future events based on custom field AND order by date
  22. Meta Data for Custom Post Type not saving
  23. Using preg_replace to filter custom textarea
  24. Check if post with same meta value exists
  25. query_posts adding extra code to homepage
  26. How to show only the most recent post on my custom post type archive?
  27. Get only used meta_values
  28. If Post Meta Equals Current Title Conditional Advanced Custom Fields
  29. How to make WP_Query not to show irrelevant posts?
  30. Is there a way to exclude posts based on meta_values?
  31. What is the ID parameter for custom post types in query_posts?
  32. Loop for custom post types filtered by a taxonomy
  33. Do posts, pages and / or custom post type objects have unique ID numbers or can there be multiple objects with the same IDs?
  34. Archieve.php not loading for custom post type
  35. Submitting Custom Post Types with custom fields from Front-end form
  36. How to limit post per page of custom post type?
  37. create custom meta box with default value
  38. Get $post->ID from a URL
  39. Displaying a div from an assigned meta_value when on a page
  40. Custom query – get_the_terms not work
  41. Meta data (Tags and Categories) for Custom Posts not showing.
  42. Display different information of a custom post type
  43. Create Array from custom post type to display a slider
  44. Setting Post Title via Meta Data returns Auto-draft
  45. How to Echo Metadata Value in Currency Format
  46. Issue on Working with Metabox – Checkbox to enable Sale Items
  47. Filter posts by tax (dropdown) and meta value
  48. delete_post_meta() for whole CPT / multiple posts?
  49. 3 random images from custom post type, each in a div with a diffrent class
  50. How to get specific post meta by title or id
  51. Why are some of my custom posts not showing up on my page?
  52. Publish and save specific postmeta to a filtered post_type
  53. post-per-page and offset not working
  54. Control content before and after custom post type loop
  55. Custom post type, custom taxonomy, query posts only from taxonomy (children of)
  56. Display custom posts randomly in custom taxonomy archive
  57. Getting all ID’s matching a title in a custom post type
  58. How to move a post to different post type with all meta data?
  59. why is the current page title being output?
  60. Why do I have to press the “Update” button twice to save my meta box values?
  61. Count custom post type based on two meta data
  62. Querying multiple values from a single key
  63. Not able to export large no. of posts in csv
  64. attach CPT data to a taxonomy
  65. How can I display a drop-down select of Post Names
  66. how to show records that don’t have custom meta value
  67. Pagination not working on custom query on a page
  68. Loop through posts of only 2 statuses
  69. Targeting custom post type via functions.php doesn’t work
  70. WP API Response does not show my registered metadata
  71. How to detect that the save_post hook is calling the callback associated to the current edit post page only
  72. find custom post type post by searching its custom field with my string
  73. FacetWP paging custom wp_query
  74. $post->post_meta not pulling any post in wordpress/php
  75. Values from meta-box not on $_POST
  76. WP_Query of custom post type sorted by meta_key has unexpected results
  77. Returning a custom content types with meta values
  78. Custom post type suddenly stoped working after WordPress 5 update
  79. Batch Extract Date from post title and put into ACF custom field
  80. copy images from custom field to another custom field
  81. How to show custom field on specific custom post type posts only when filled
  82. How to handle this specific case of custom post type?
  83. Save CTP post meta different values each day without overwriting previous values
  84. get_post_meta returns NULL in front-end, but correct result in back-end
  85. Can’t change posts per page in WordPress Post Type Query
  86. postsperpage value not being applied
  87. Cannot obtain custom meta information
  88. Problem with adding custom post type meta to header by plugin
  89. is_main_query() never called on WP 4.4
  90. How can I output WPAlchemy repeating fields meta values in my page template?
  91. Meta box data is saved but NOT displayed in the meta box text field. Why?
  92. How to call a post’s metadata in shortcode.php?
  93. Best way to create a search for custom post type by custom field values
  94. Dynamic category name in query post
  95. Save Metabox Custom Field Value
  96. Echo custom post meta from options array
  97. Value of post meta dropdown is not showing in WordPress
  98. Incorrect ordering of custom post type based on time
  99. Meta box data not saving
  100. Get all metadata for a given custom post type
Categories custom-post-types Tags custom-post-types, post-meta, query-posts
How to enable admins/editors to set a featured image for specific category?
WordPress Thumbnail add action if no thumbnail

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