You overwrite the global $post which is where that function gets the post ID from to fetch your custom field. You need to add wp_reset_postdata() after you run other queries that use $post.
Related Posts:
- How to update custom fields using the wp_insert_post() function?
- Getting movie and serial on actor page
- How to loop over custom fields in a page template?
- Make custom field meta not display if there is not data in it
- Use template for posts with a particular category grandparent
- Custom field value not saving when it contains a URL?
- Automatically add custom CSS to new posts using a category template
- Why not yield/iterable in posts interface?
- How can I add extra word in permalink when someone click download button?
- Open post-content in archive page in a Modal box with bootstrap
- Which PHP page is the Default Posts Page
- Why is a wp function used in current PHP namespace’s callback not resolved to global scope?
- WP_Query: getting posts where custom field exists
- How can I get “Previous” and “Next” to show in the navigation besides the links?
- Woocommerce Custom Meta Boxes- How to only display if they actually have content
- get value from get_post_meta then reuse it in another get_post_meta
- Display articles with a different template in the home page | Solved |
- Query on a repeater date (acf)
- How to display last whole post on the homepage
- When working with a post, almost all wp_postmeta are deleted
- Displaying POST content with HTML tags and all
- What syntax is this? “{{post.price}}”
- Posts sortable column not sorting properly for custom field numbers
- Query posts by custom fields (object post)
- Need Help With Making Full-Width Template for Blog Posts (common methods aren’t working)
- Category Attachment Pagination 404 Error on 2nd Page
- Only get_posts of certain post formats
- Remove option to allow trackbacks/pingbacks from post page options
- Get the php template file from other theme folder
- How can i create a function to get youtube video time
- Match checkbox data with page title to show certain items
- Geocoding an Exploded Custom Field Array
- Handling an Ajax form submit
- Unable to set right time in admin and frontend template
- WooCommerce: update custom fields after checkout validation failure
- Automatically generate Post/Page from searched Database item?
- Add a Second Menu to a theme that only support 1 menu
- Custom excerpt function re-factoring
- Inject PHP code into “sidebar-content” – code before my WooCommerce sidebar widget?
- Hide post if matches current month and year
- How Display Posts on category
- creating a second image attachment template?
- How to show single category archive
- Issues getting PHP to display in category pages
- how to retrieve a value if a checkbox is checked
- Two queries for a WP_User_Query search work perfectly apart, but not together
- Secondary navigation menu on one page
- remove post that has no content
- How to show only subcategories in parent category not parent category?
- Non-Closing PHP Query in WordPress Loop
- Is there a way to hook or call a custom woocomerce template that is not part of the default templates of woocommerce?
- Copy taxonomy terms from one post to another programmatically
- How to show/hide php table rows based on the content of custom fields
- How to call multiple functions from multiple files into a WordPress page template [closed]
- What file have I to create in my custom WordPress theme to show all the post belonging to a specific category?
- how to get serialized post meta
- How to catch wordpress post ID when it’s published
- add_filter function concatenate string and locate_template function
- WordPress upload file size error even after raising php limits
- Conditional featured image with youtube thumbnail
- Add a custom class to the body tag using custom fields
- how to edit a specific post slug using a php code?
- How to pick “full/thumbnail” images in the loop?
- Saving a post ID to use in a form elsewhere on website
- php loading different structure than source code
- How To Use Custom Fields With .mp3 Links
- Prevent post from being published and show error
- Pagination at category doesnt work with same name of page
- Updating Metadata with Shortcode
- Require()/Include() post template adding extra content
- Setting up a cron job to auto update a custom field
- Change the “Show All” button in a WordPress Portfolio Filter
- Trying to retrieve meta values from three different meta keys and display in rows
- How to pull date/time in french format for wordpress post?
- WP post meta – for loop inside for loop
- Store custom field’s multiple values in one user meta key
- WooCommerce multiple custom fields code
- WordPress Single Post Pagination Numbered and Navigational
- Let user select the number of posts shown per page jquery error
- Add wp posts to cutom masonry grid
- WP_query meta_query slow with OR and DATES
- Displaying 3 Category Posts differently
- meta field for numerous links
- Add point on excerpt post
- WooCommerce – Print Processing orders [closed]
- Loop returns more items than exist?
- ‘posts_per_page’ in costum page type
- divide custom field values in div every two values
- List of child pages fetch next results at link click
- Showing custom field contents without listing description
- How to exclude post from being queried based on custom meta value
- If I define a variable in header.php, how do I make it available to templates?
- Search result page – display values from the result’s metaboxes
- How to modify this function to exclude also the post belonging to a specific category?
- Set post to draft if matching word is found in the post
- Find owner of coupon
- How to initialise WP_Query on the basis of a specific meta_value and continue iterating rest?
- Custom Admin Menu Report for Specific User ID
- wordpress-plugin (widget) that performs a Neaby-search on the openstreetmap-endpoint: around x find y
- Want to add custom post type for facebook feed