If you have the CPT’s ID in the $event_id
variable you plug into the get_post()
call – why would you not simply just (re)use that for the first parameter of get_post_meta()
?
That aside, get_post()
returns a post object (instance of WP_Post), which you choose to assign to $event
. Hence $event
now has a public property $ID
, which can be accessed by $event->ID
.
Related Posts:
- WP_Query – Order results by meta value
- Custom query with orderby meta_value of custom field
- Orderby meta_value only returns posts that have existing meta_key
- How to enable revisions for post meta data?
- Any way to add custom options to Gallery Settings?
- Can I query custom meta data through WP_Query
- Including custom fields in search?
- Change behavior of “Insert into Post” based on attachment metadata
- Sort posts by custom field numeric value using dropdown
- How to position a custom field before the editor
- How can I display all values of a custom field from posts with a certain value of another custom field or from certain post types?
- passing argument to get_template_part() or a better way to code
- Is there a way to do multiple ordering on a multiple meta_query?
- searching in custom meta field
- How to add upload field in a custom taxonomy?
- Display thumbnail from custom field
- Bulk move (or copy) from a custom field to the post content?
- Getting Custom Field data from a page hierarchy
- Custom contact form 7 select with custom values [closed]
- limit amount of photos uploaded per cpt post
- Problem with adding exta field in metabox in custom post type
- Move value of one custom field to another
- Setting orderby to a custom field using pre_get_posts
- little help with a mySQL query to wp database
- Add WYSIWYG to Image Description field
- Calling custom profile fields?
- How to Display Custom Meta Box only on Specific Page IDs
- Get custom field label
- Show ACF fields only on certain page in the backend
- Performance of storing multiple meta fields vs one JSON encoded field [duplicate]
- Create Multiple File Upload Metabox in WordPress
- WP_User_Query pulling ACF to loop
- how to put a custom field value in variable
- Custom Metabox Not Saving
- How to add the image URL from an external RSS feed and insert into a custom field?
- My custom backend codes shows up when i try to view my website
- Advanced Custom Fields dynamic update_field
- Custom Profile Fields move from BBpress to BuddyPress
- How can I output a list of values for a custom field, and posts with those values?
- Manipulate javascript code from custom made admin page menu
- Add additional ‘description’ field for defined roles / role metadata?
- Change the main loop WordPress impact on the server?
- How to get categories with posts by custom field value?
- Meta Query returns wrong number of posts
- What is the largest value you can store in a custom field (as meta data for a post)?
- Where does this field get its value?
- Get all the posts where meta field with multiple choice has several values checked
- Warn user that data may be lost for custom pages
- List custom field values in alphabetical order without repetition
- Can’t query by meta_key
- Display MP3 as media using an URL from a custom field
- Inserting data into MagicFields using mysql queries
- Custom Field box history
- WordPress custom fields feature is missing in my installation
- Print Posts if Custom Field Value Date equal or greater than Today Date
- Update post meta custom field using block editor
- If I update WordPress my custom data will be deleted from the wp_users table?
- Get emails from users by custom field SQL
- Convert all dates stored in custom field
- Why am I getting a “Call to member function format() on a non-object” error?
- Plugin or shortcode for ISBN number?
- HM CMB: Role Select
- How To Show Get Adjacent Posts If Posts Are Sorted By Custom Field
- How to calculate custom field value (average)
- WP-eComerce Advance Meta Tag data in descending order [closed]
- Custom Query Fields – Altering Meta Value
- Adding re-type email and check it if the email match
- show a specific metabox dependent on the page template
- excluding posts by an ACF field in pagination
- Search & column order by meta value in admin
- Exclude URL’s from sanitize_html_classes
- Best way to insert a list of links into a post outside of the_content
- How to add a post’s view count into the WordPress API response
- How can I ‘check’ the “custom fields” box from the Screen Options?
- Line break description wordpress
- How to get all wp_posts in wordpress fetched from database
- Update custom field on the fly
- Custom field disappeared from screen options
- Search fails when using the radio buttons
- automatically add custom fields to post title
- Custom Fields Permalink Plugin not observing hyphens
- will wp_insert_post write a new custom field to the database?
- How to repeate custom field group with bulk image field
- ACF – Compare user and post data
- How to format the various types of custom fields?
- Extra text’n’image field in a page
- Get first URL from custom field, download and set as featured image on post publish
- Media Attachment Custom Meta Fields not saving in Media Uploader when using jQuery UI Autocomplete
- How to add an option to admin to add image that could be used as header?
- Include custom fields into the content of a regular page
- Bypassing a Form Options
- How to query posts that have certain post meta keys, and sort by meta key and/or value
- How to implement jquery-ui autocomplete into custom fields?
- Add image custom attribute [closed]
- Foreach giving one too many list items, how can I remove the last empty line?
- I used a custom field for header image and can’t get it to show up on posts
- Add custom fields to specific menus
- Add CSS class to posts with certain meta key
- Best way for managing images of ads banners
- Crop custom image size vs actual size