This function returns the values of the custom fields with the specified key from the specified post. It is a wrapper for get_metadata('post'). To return all of the custom fields, see get_post_custom(). See also update_post_meta(), delete_post_meta() and add_post_meta().

learn more… | top users | synonyms

0
votes
1answer
8 views

How can i get multi checkboxes value in metbox?

I make list of check boxes by WordPress meta-box and i can not get this value in my theme. i can get my text value with this code <? echo get_post_meta($post->ID, $prefix . 'text', true); ...
0
votes
0answers
27 views

get_post_meta() cannot return values from nested arrays

I apologize if this question was answered on here. I searched and could not find an answer that related to my own issue. I've been turning my wheels on this for three days now and am now seeking ...
0
votes
1answer
13 views

Related query shows same image in loop

I'm using the code below to query all other posts with same value in custom field FeaturedArtists. Works great except the images. All images are the same as the current post. If I change ...
1
vote
0answers
36 views

How to use pagination with get_post_meta

I have a Products Page that i am using to add products using custom metaboxes this is the code for my page <div class="container products"> <div class="row"> <?php ...
2
votes
2answers
44 views

Custom post meta field effect on the performance on the post

I have the posts which have many custom defined meta fields. On posts I am calling them on requirement using get_post_meta. Means for 10 meta fields I am using it 10 times. Am I doing it right? ...
0
votes
0answers
42 views

Automatically add custom fields (post_meta) to all published posts, hourly, via wp_cron?

I'm trying to update the post meta of all published posts hourly (via wp_cron) with the code below: if ( ! wp_next_scheduled( 'postviews_updatedcounts_hourly_event' ) ) { wp_schedule_event( ...
-1
votes
1answer
34 views

How to echo get_post_meta (Fluent-Framework)

PHP beginner here. I purchased the Fluent-Framework plugin, which allows me to easily crease Post Types, Meta Boxes, and Option Pages within my theme. I am having trouble echoing the Meta Boxes, ...
0
votes
0answers
13 views

selected into metabox doesn't show up

I have been using the very known metabox switch code but something weird happens. In the metabox, only checked boxes have been saving. The selected field doesn't show up the selected option ...
0
votes
1answer
77 views

Display custom field meta outside loop, site wide

I've created a custom field ("breaking") with the goal that whenever one post has this field present, it will display the value in the header throughout the site (that is, all posts, pages, archives, ...
0
votes
1answer
42 views

Howto: use existing post_meta as options for a different metabox (checkboxes or list)

I want to create an "Employee" Custom Post Type ("Add New Employee") wherein the employee may belong to one or many offices. The user needs to be able to add/edit/delete offices via a separate ...
0
votes
1answer
51 views

Trying to write shortcode with get_post_meta but isn't working

I am trying to write a plugin with a CPT and have a shortcode to display the data. I can get 'the_title()' to work and display the title of the post type but using 'get_post_meta()' I can't seem to ...
0
votes
1answer
124 views

adding meta tag without plugin

Is it possible to add meta title, meta description, meta keywords in every page without installing plugin? My client require not to install plugin. I am curious about this case, all I know is the ...
0
votes
0answers
34 views

get_post_meta Not Working After Moving The Second Custom Metabox to The Side

I got 3 custom metaboxes in my custom post type. The previous structure is like the following: Metabox 1 Metabox 2 Metabox 3 If the Metabox 2 is moved to the side, the Metabox 1 won't be able to ...
0
votes
1answer
171 views

Show value of select dropdown in meta box

I have created a meta box which has a select dropdown list and i want to show it in the post as a user selects a particular option from meta box.I cant figure it out how its done.Here is my meta box ...
0
votes
0answers
54 views

Getting attributes from custom_post input

I'm having custom field created like that: function woocommerce_form_field_numeric_2( $key, $args, $value = '' ) { global $woocommerce; $defaults = array( 'type' => 'number', 'label' => '', ...
0
votes
0answers
56 views

how to echo/display the custom field value in specific custom field name?

I have tried this code: <?php query_posts(array( 'meta_key' => 'custom_cat', 'meta_value' => 'creative', 'post_type' => 'page' )); ...
0
votes
0answers
40 views

Multiple meta data one label

I am wanting one label but multiple data to be under the label. I also want to reference each input option individually so that I can query for specific meta data. Currently I have, function ...
0
votes
1answer
75 views

Hide a div when a custom field is empty

I am having trouble hiding a div when the input of a custom field is empty. This is the code I am using but can not seem to get it to work. The field that displays the content is _cmb_fe_wysiwyg ...
0
votes
0answers
20 views

Accessing post_meta on save of new post

I am trying to get the value of a post_meta when the post is published. The problem is that all I can get is the post ID, but the post_meta must not yet be in the database when I make the query. I do ...
0
votes
1answer
49 views

get_post_meta() empty in preview WHEN custom post is published

So my client managed to find some (bug?), when custom post is published and he previews post all information what is posted with custom meta boxes is inaccessible. When I started debugging I found ...
0
votes
1answer
81 views

get_post_meta fields don't show up on posts page

I'm new here, and to coding! I've been working hard (so, so hard...so hard) to create my website and with occasional help I've created a look and feel I like using some custom get_post_meta fields for ...
0
votes
1answer
27 views

Adding custom fields to images

I want to show sources under my every images. So basicly I want to add a simple custom field. I added this code to my function.php add_filter('attachment_fields_to_edit', 'edit_media_custom_field', ...
0
votes
0answers
60 views

How to save dynamically generated value in post type?

I'm trying to use the count of the amount of people that register a post id to a table in the DB. I want to save this COUNT value to the post_meta so when I display the list of posts it can also show ...
0
votes
0answers
486 views

get url image of custom field with custom size - get_post_meta, wp_get_attachment_image_src

I use a custom WP_Query to load image and other information from custom post type event to supersized.js script. This query get all custom post type event with custom field wpcf-img-event not empty ...
-1
votes
1answer
129 views

Display post's description and caption

I am trying to get and display 5 featured posts. To achieve this target I have an offset of 5 recent posts. I have successfully fetched the posts' id's and images, but I failed to get every post's ...
0
votes
1answer
29 views

Can't Output get_post_meta?

I have a custom field for my post and I am trying to output it onto my post's page but nothing appears. I know my code works otherwise if instead of trying to call my custom field, I use a fixed ...
0
votes
0answers
53 views

Use custom field “date” compared to today's date to display & order post list

I am at a loss here. I have a custom meta field blser_date where the client can use the date picker. The meta field is setup in a meta box array (this may be an issue b/c of the key?) Here is the full ...
0
votes
1answer
53 views

get_post_meta slowing down my page load (in a plugin)

I've been working on this project where I need to load events (custom post type) and a whole bunch of meta data for every event. The problem is that page loading times are getting longer and longer ...
0
votes
2answers
108 views

User function to return multiple get_post_meta()

I am trying pass a WP function to a user function, where I can pass a new func argument $key for each post_meta type here: functions.php function my_post_meta($key){ $meta = ...
0
votes
1answer
63 views

Hide H1 Title using the_title filter

I am trying to hide the pages H1 header IF a custom field specifies this. On a page back end I have added a custom field: Name = hide_title Value = true I then want to hide only the H1 using a ...
0
votes
2answers
117 views

get_post_meta in WP_Query

I'm doing a plugin to add likes to posts I want to create a table on a page in the plugin to show each post and the number of likes function my_plugin_options() { echo '<p>Table of ...
0
votes
1answer
398 views

Meta Data for Custom Post Type not saving

I'm in the process of building a custom plugin, and I'm having trouble saving meta data for the custom post type. The boxes display correctly in the editor, but when I click Publish or Save Draft, the ...
0
votes
0answers
555 views

Where should get_post_meta() go to get $post->ID get_post_meta() is empty and $post->ID & get_the_id() are working

EDIT: So I added the full code. What I'm trying to attempt is to get the post id into the metabox values for a publish immediate and scheduled post. It appears that I'm having trouble passing the id ...
0
votes
1answer
93 views

get_post_meta is returning image id

I'm using this script to get image filename, stored in a custom meta called background: $background = get_post_meta( '22', 'background', true ); echo $background; But it is returning the id of the ...
0
votes
2answers
61 views

Setting Post Title via Meta Data returns Auto-draft

I've read here and other places about setting a post's title based on it's metadata. Unfortunately I'm unable to get it working and I'm hoping someone else can point me in the proper direction or ...
0
votes
2answers
115 views

get_post_meta with WP_query

I know this is a convoluted loop (inherited from someone else), and this must be pretty simple: the_permalink and the_title display OK, but why doesn't my post meta eventdatestart echo?. <?php ...
0
votes
0answers
56 views

Getting meta content from get_next_post & get_previous_post

Is it possible to retrieve meta content for the get_next_post() and get_previous_post()? I'm currently using the following method, but not having much luck: <?php $prev_post = ...
0
votes
1answer
28 views

Check whether attachment ID is associated with more than one post?

Is there a function to check whether an attachment ID (=get_post_thumbnail_id(..)) is associated with more than one post? With "associated" I mean that a posts's meta value for the meta_key ...
0
votes
1answer
365 views

Showing Meta Data for Custom Post Types?

I'm busy learning some basics behind Wordpress development and so far I'm getting on quite well. However, I've hit a stumbling block. Firstly, my test site is; http://popcorn.canny-creative.com And, ...
0
votes
2answers
397 views

Get meta value and associated user meta

I'm working on a site where users are able to publish posts with custom fields associated with them. I want to display meta values from all posts, and include which user created the post where the ...
1
vote
1answer
285 views

How to count post meta key values for all posts in database

In my post meta data I have the following 'key' for every post: "image_details" a typical value of which is an array such as: ...
0
votes
0answers
38 views

search page id issue

I have a little issue with something i working at. I have a notice on 404 pages and on search page when i try to find something that do not exists. Notice: Trying to get property of non-object in ...
-1
votes
1answer
62 views

Colecting values from custom field checkboxes and displaying them in the post

Ok, i have a form and a input fields type checkboxes. But in the post appears only the last value, what can be the reason? <label for="extras"> Extras </label> <input type="checkbox" ...
0
votes
0answers
315 views

Humanmade | Custom meta box class: How to display a repeatable meta box group?

I'm using the Humanmade | Custom meta box class to add meta boxes to my themes admin pages. I have integrated the class and have been enjoying the use of adding meta box's to my current projects ...
0
votes
0answers
35 views

How can I get the open graph thumbnail url?

I use WP SEO plugin to set the Open graph image meta, because my template does not support featured image thumbnails. Now I want to use the YARPP related posts plugin which uses featured image ...
0
votes
2answers
135 views

Displaying values from related field - if empty shows current post type's link and title

I'm working with custom post types. In the post type awards I have a relationship field that links each award to a post from the post type project. I'm using the following code to return the values ...
1
vote
1answer
256 views

get_post_meta doesn't work

I created a custom meta box inside a page but I can't display the content! I'm inside the loop and here there is the code of my functions.php: $meta_box['portfolio'] = array( 'id' => ...
0
votes
1answer
259 views

Dynamically get the meta key value of a menu item based on it's post ID

I have a menu, that I need to insert an image that have it's path saved in a meta key (_menu_item_img) and associated with a post ID, every menu entry has it's own image, and I need to grab it ...
0
votes
3answers
212 views

How to Echo Metadata Value in Currency Format

I have a Custom Post Type with a Metabox and an input Text field for adding "Price" to the posts. Now I would like to display the input value which can be like 49 or 59 like 49.00 or 59.00 so far I ...
0
votes
1answer
211 views

Difficultly changing date format in post meta value

I have a custom post type with a custom field that takes a date. The posts are later ordered by the date in that custom field. Unfortuately I formatted the date incorrectly and there are already a ...