Please take some time to read the Codex. the_ID
echo
s content. That means that the ID is never being passed to get_post_meta
. It is just echo
ed in place. From the same Codex Page:
Note: This function displays the ID of the post, to return the ID use
get_the_ID().
So, use get_the_ID
instead.
Second problem… quote your string. As you have it written PHP will try, and likely fail, to find a constant named newtheme_section_id
. I don’t think that is intended.
$meta_values = get_post_meta( get_the_ID(), 'newtheme_section_id' );
If that code is in the Loop, it should work.
Related Posts:
- How can I create a menu items from meta box based on users input
- Display a custom field rating system in the front end
- How to change the case of all post titles to “Title Case”
- Dynamically add id to heading tags
- Update all posts automatically when using post_meta
- Restrict users from editing post based on the age of the post
- meta_box or custom_field as a second tinymce post-instance?
- Guest Author – How to modify my custom function code if the guest author URL will follow a particular pattern/format?
- Create A Metabox For A Custom Field
- $post object is null
- Function to show random posts from a category
- Automatic value for custom fields for posts
- How to rename “Publish” metabox title in post screen
- Understanding and using metaboxes in posts
- Trying to retrieve post meta
- Redirect to another page using contact form 7? [closed]
- Which PHP page is the Default Posts Page
- How to I retrieve the ID from the Posts page?
- Why does this update_post_meta function not delete the custom field itself?
- Hide custom metabox value from custom fields
- Adding a user’s ID behind the tag ref link address
- saving/reading custom field value does not work – no value gets POSTed
- Why my meta boxes won’t show in front post page?
- How To Use Custom Fields With .mp3 Links
- Display content between two dates?
- Adding an option to post editor to show a site disclaimer or message
- How to limit the number of results for all query_posts on mysite
- User driven content problems
- List direct children of page
- How *not* to show the last post on the latest posts list
- Display custom meta box in my template file
- str_replace the_title(); blues
- Enabling post thumbnails for custom post type
- Run a function when post is deleted?
- Only display posts after current date
- Checking is user author of number of posts?
- Add custom field automatically (add_post_meta) with value based on number of words of article
- Create cron job without a plugin?
- Global $post not working in OOP function WordPress
- How can I get a post field value using javascript?
- A good strategy to print custom posts (offer) that are checked inside the metabox of a post?
- Getting current post ID in functions.php
- Accessing post->ID outside of the loop for listing child pages
- how to set beforsend option in wordpress ajax methods
- Action hook for new pending posts?
- Uppercase first sentence in every post
- Add icon/badge next to posttitle of specific category
- Adding dropdown select meta box to custom post type – seems restAPI is interfering
- Query all posts of a custom taxonomy term
- Ajax posts filter by date, comments, top views, top likes
- Duplicating Table of Contents for Paginated Post
- What’s the difference between same wp functions get_posts(); functions in different form?
- Prepend or add an Image to the content of a Post
- Converting a dynamic piece of code using WordPress Loop into a static one using Post ID
- Dashboard :10 Last draft page and 10 last pending review page (metabox)
- Why content_arr[‘extended’] removes paragraph tags?
- Passing the custom field values in the wp_get_current_user array function
- Guest Author – How to display posts on /author/ archive page
- Display post category in foreach loop with category link
- Can I prevent the user from adding more than two levels deep of terms inside of a taxonomy metabox?
- Image media upload metabox
- WordPress Custom Fields (Checkboxes with multiple values)
- Load post attached images on a single page site with fancybox
- Custom Metabox Not Saving
- WP_Query orderby not working with meta_value_num and menu_order
- Why WP_Query(‘showposts=5’) shows only 1 post?
- How can I sort posts by the date and a custom meta field?
- Most liked page not displaying posts
- How to make number of blog posts a custom field?
- Linking text within textarea of custom meta box
- Exclude category from
- Get post id in a function when edit/add a post
- How do I correctly set up a WP-Query to only show upcoming event-posts?
- How to display Common posts from specific Tag & Category with Shortcode
- Setting posts_per_page for taxonomy term template
- Change post order random through out the entire WordPress
- Adding custom fields to bbpress reply form
- wp_trim_words() does not work with my code Am I doing any mistake in my code?
- Need Help Fixing My Iframes [closed]
- get_post_meta not working on publishing
- Firing schema via code in functions.php doesn’t work
- How to display the link (title) and thumbnail post?
- How do I update a field of a meta box?
- How can I add extra word in permalink when someone click download button?
- Force the “Choose from the most used tags” meta box section to always be expanded
- Show the content that is after the excerpt using child theme
- Automatically add custom fields value to wordpress post
- How to allow users to post only in certain category and hide elements from edit page?
- Meta value does not save for scheduled posts
- Is there a way to notify specific users when new posts are published to specific pages?
- 3 Slashes appear after Apostrophe in custom fields after updating product-site
- How to do set post permalinks using 6 digit random unique function?
- Can’t get buddypress notifications in front-end; why do I get this error?
- Custom Attachment Caption Fields
- How do I display some posts fully on the homepage, and some as an excerpt only?
- Homepage’s content is dependent on the custom field values (set automatically), how do I get homepage to update without manually updating page?
- MySql query to get posts with all meta and terms
- Cannot save CPT meta box
- Categories list into registration form
- Send post id through ajax and get the post content back