You don’t have the $post
object, but trying to use it in the code ($post->ID
). Use get_the_ID()
function instead:
<?php
while ( $cat_query->have_posts() ) : $cat_query->the_post();
// $gread = get_post_meta( $post->ID, 'read_time', true ); // Wrong
$gread = get_post_meta( get_the_ID(), 'read_time', true ); // Right
endwhile;
}
From now forth always enable debugging when you develop. In such a way you’ll avoid wasting your time and asking unpractical questions.
Related Posts:
- Is it safe to store a user setting you don’t want the user to ever modify as a user option?
- Add custom fields to search
- extend Meta Box / Document Panel
- Add multiple images to a page sidebar
- getEntityRecord without knowing the post type
- Add custom field to image editor
- How to load php file for specific page in admin?
- How to set default metaboxes on user creation?
- Metabox nonce PHP notice
- ajax jquery update custom field meta value front end
- How to break meta values into different items and avoid duplicates?
- ajax delete value from custom field array
- How can I sort get_users() by any value (last_name, user defined fields and more)
- Custom field for default gallery
- After moving my site from a dev subdomain, to root, all my custom meta data is gone
- Add input field to ‘Pages > Edit Page’ through functions.php
- How can I query on the year part of a complete date in a custom field?
- WordPress Custom Field Should be Unique. Is it possible?
- all tincymce’s switch when updating page after changing from html to text in custom metabox
- How to display Meta Field Value?
- Upcoming Event: How do I sort database by custom date field, but ignore past dates?
- What is the cleanest way to extract custom variables from a post
- Add source URL from Feed WordPress (Syndication) plugin to a custom field in post editor
- List custom taxonomy terms from custom field
- Order query by meta_value with multiple custom fields
- How do I create a column in Users list and display user data from custom registration field
- Display only past events on that page using Visual Composer Grid Bulider
- user Profile meta value as custom field
- Remove Body Classes
- Use WPbakery for own custom field [closed]
- Product Custom Fields with HTML and JS
- Add new image block, set default class name and update it using Javascript
- Add custom field to all posts in specific post_type
- Change the sort order for posts to include custom field
- Button inside Custom Meta Box triggering the Update Button
- Get Data From wp_sitemeta for Multisite network
- Syntax Issue: How Do I Call A Custom Field Inside a ForEach Statement? [closed]
- Get image url using image id
- Get categories query not working in function.php
- wordpress custom loop ascending descending posts by custom field
- Hide custom fields when empty
- Only show when content added via custom field
- Using a custom field inside a shortocde
- Add Custom Profile Field as Notes
- How to add fields in custom registration form, validate it and aave to db? [closed]
- How add multiple wp_editor_box to new post
- Woocommerce frontend edit custom fields
- Related query shows same image in loop
- How to insert multiple checkbox values into post as custom fields from frontend
- Insert posting automatically based in acf field
- Data URI in custom fields
- Add specific custom fields to post formats
- Displaying an ACF list of users
- Fallback for empty custom fields
- wp_editor on custom meta textarea field – images and html fails
- using custom fields on content.php file of my theme
- Hide / Show Custom field depending of the page ID (Magic Field 2)
- How to show certain data on certain interval of period
- Problem with writting correctly a query posts args in WordPress
- Add a field to just ONE page
- get_post_custom_values problem, please help
- How to parse a huge list of users using a CRON function?
- Counting post fields
- How To Save Data From Remote APIs To ACF?
- comments_where Hook
- add_comment_meta not working properly
- how to enable custom fields in the Gutenberg post editor
- Missing Custom Fields
- Automatically Add Tags Taxonomy in Post from Custom field’s value
- Is there any way to make a custom field for a post only if the author is a certain user?
- How to I change the value of a custom field on the home page?
- searching by keywords in post’s metas or pagination links problem
- Permanently show Custom Fields in Editor
- open modal window
- a lot of custom fields
- Hide custom fields by user’s role
- Ordering posts by custom fields (Date)
- update meta field value after
- PHP and Shortcode Combination
- If metabox fields has content display content
- Retrieving Advanced Custom Field within Shortcode Function [closed]
- Custom fields and auto save
- Save values generated via API as custom meta fields
- Get custom fields when hover link of post
- WP Query multiple select form – meta_query help
- update_post_meta not working in action hook
- Load code for custom fields only on admin pages?
- Custom field in a shortcode?
- Group pages by custom field values
- Exclude empty fields from custom field calculation (Average)
- How to create Parent-Child relation for custom fields?
- How to check if custom field exists in this widget query
- display loop only if a post meta data exist
- How do i output images from URL’s added to the same custom field key
- Add Custom field under the post title [closed]
- Filter Query Post by Custom Fields(by date)
- Can’t sort custom column on user.php by number / meta_value_num?
- Need to call this php function inside a modal window from text widget
- Truncating characters in Advanced Custom Fields works some places but not others?
- How to add an ACF only for parent term?