Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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().

0
votes
0answers
12 views

Is it possible to remove a conditional value from WordPress custom metabox

Here I have attached the screenshot from MySQL for easy understanding. In this meta value a: denotes total no of users liked the post. User denotes user with id user-id My question : Is it possible ...
0
votes
1answer
16 views

Reverse Cross-Sells (WooCommerce)

When you run get_post_meta( get_the_ID(), '_crosssell_ids',true); you get an array of all the products that the current product cross sells to. How do I reverse that? To get all the products that ...
0
votes
1answer
24 views

get_post_meta not working with variable as a post_id for dynamically get the postid

I would like to use the get_post_meta to pull a value from a CPT dynamically and then send a email. The problem is that the get_post_meta($post->ID, ... part of the code does not pull the email ...
0
votes
2answers
30 views

why get_post_meta is returning 0?

I'm trying to show all the posts on a page with an audio player in it and for that I'm looping through posts in the following manner: <?php $posts = get_posts(); $ID; foreach( $posts as $item) { ...
0
votes
1answer
51 views

copy images from custom field to another custom field

On my wordpress site I have a front end form that allows users to create posts and upload photos for a custom post type 'Property'. Using the following function - $property_sights_value = ...
0
votes
1answer
38 views

Custom Function to redirect singular post if specific meta field is empty

I have a custom post type People that has several metafields. When the ecpt_bio meta field is empty, the post will link to whatever URL is entered in the ecpt_website meta field on the post archive ...
0
votes
1answer
20 views

How to store multiple custom meta box

I am trying to store a multidimensional array of a Quiz where I dynamically add question box. But I am not able to figure out how to store dynamically added question box. The code is below function ...
1
vote
1answer
24 views

How to receive all the meta information of a post ?

How can I get all the meta information of a particular post_id, if my meta_key = 'title' and meta_value = 'My Content Template' meta_key = 'download_url' and meta_value = 'http://www.example.com/pdf/...
0
votes
1answer
35 views

ajax delete value from custom field array

I have on my page a multi file upload that saves post attachments within a custom field --- if (!empty($_FILES['vidPix']['tmp_name'][0])) { $i = 1; $files = $...
0
votes
1answer
52 views

Save attachment custom fields on front end

I have a front end post form that lets users upload multiple photos and on there I have 2 input fields to try and save custom meta data for each attachment - $vid_pix = get_post_meta($v_Id, 'vid_pix',...
1
vote
2answers
74 views

Display post metadata: “title, category, author, date” with shortcode

How to create shortcodes to the standard post-metadata "title, author, category and date" in order to display it in post-content? E.g. post-content including shorcodes: Lorem ipsum dolor [post_title]...
1
vote
2answers
42 views

What Wordpress function to use to get meta value by using meta keys?

This is the code: if ($keys = get_post_custom_keys()) { foreach ((array) $keys as $key) { $keyt = trim($key); if (is_protected_meta($keyt, 'post')) { continue; ...
0
votes
1answer
122 views

update_post_meta in loop changing ALL values

I have a button on the frontend that updates the value of post meta on the backend, and it's nested inside a loop. However, on submit it updates the value on ALL posts. What am I doing wrong? ...
1
vote
1answer
38 views

get_post_meta pagination

I have custom field, array with multiple values $metas = get_post_meta($post->ID, "$meta_key", false); foreach ( $metas as $metas ){ echo $metas; } Of course this will return an array. ...
0
votes
1answer
22 views

Print specific values stored in a post meta array

I'm triing to print some values stored in a post meta. My post meta_values looks like this : a:3:{s:6:"amount";s:117:"€2.00";s:6:"entity";s:5:"11854";s:9:"reference";s:9:"800146779";} I'm ...
0
votes
1answer
55 views

Easy Image Gallery - Retrieve Serialized Data

I am using Easy Image Gallery. It is called: _easy_image_gallery and looks like it's an array like 1234,5432,2345,..... Now, Easy Image Gallery update to 1.3 is saving into a meta called: ...
2
votes
0answers
155 views

get_post_meta returning empty string when data shows in the database

I'm absolutely stumped and I'm hoping this is something stupid that I just can't see because I'm too close to it. Working on an LMS using Sensei. Trying to get the course_id from a lesson. Pretty ...
1
vote
2answers
73 views

get_post_metadata() undefined when used in loop in RSS template

I understand how to use get_post_metadata(), however this code in a custom RSS feed template: while( have_posts()) : the_post(); // Has a custom URL been supplied? Use that in preference. $...
0
votes
1answer
45 views

Add custom field information to source meta data

I try to add information from a custom field into the metadata in the source code. While searching for the solutions I found some. As I am not really an expert I ask you guys. I want to add ...
1
vote
0answers
21 views

delete all post with certain meta_keys

I'm currently trying to delete metakeys once my plugin is uninstalled to keep the database clean. My code is as follows: Array of meta_keys that are created $keys = array ( '_menu_item_icon', ...
0
votes
1answer
41 views

Can't access post meta on new post creation (cpt)

I'm using... function on_CPT_request_publish( $new, $old, $post ) { // ----------------- Start of Function ----------------- if ( ( $new == 'publish' ) && ( $old != 'publish' ) && (...
0
votes
0answers
41 views

How to integrate Stripe in WordPress with not Plugin?

HEADS UP: This post is going to be long!. Thanks in advance for helping me out with this problem. Hello guys so I've been working on a portfolio page for a client website and I need to integrate ...
-1
votes
1answer
37 views

Documentation for post meta

Trying to solve this problem I tried to find the complete list of all available/possible default "post meta" tags/entries. I couldn't find this info documented anywhere. Any pointers?
0
votes
0answers
79 views

Retrieve Custom Taxonomy data

I'm using gravity forms to dynamically populate a dropdown field using posts from a custom post type called feedback. I got the work around for this documentation here: https://docs.gravityforms.com/...
-1
votes
1answer
43 views

Save meta data with post, Without using any plugin [closed]

I have a post type in which I need to save price with each item. Please, suggest how can I create meta-field in my post type, without using any plugin?
-1
votes
2answers
167 views

How do i output images from URL's added to the same custom field key

This is my array of image URL's added to the same custom field named images. $images = get_post_custom_values( 'images' ); I need to print all these images in a template file.
0
votes
1answer
101 views

Using Self Hosted Video URL With Custom Fields

Can't get this to work with a self hosted video URL added to a custom field. function video() { $self_hosted = get_post_meta( get_the_ID(), 'self_hosted', true ); $video_self_hosted ...
0
votes
2answers
73 views

Check for custom field value in different post type than current one and do something

I have 2 post types, one is for my posts and the other one is used as a submission form. When a user is on a single post page for post type A, I am trying to do several checks to then display ...
0
votes
0answers
55 views

Dedicated post meta field vs count of meta fields

I am working a integrating a post like count to my plugin. I am having trouble understanding the logic that will impact performance. I have found this post that touches on the topic a bit. I am ...
0
votes
1answer
293 views

Get value from an input field and pass into update_meta_data as $meta_value

I am building a woocommerce site and I have some input fields the on the product page. one is for recipient email (its for a gift car). Everything works, and the recipient email is saved on the order, ...
0
votes
0answers
86 views

Hook after post was created to update Custom Fields

I'm tryin to update post meta after a post was created but the get_post_meta function is not working. I have tried transitions, and almost every hook from documentation. The save_post_post , ...
0
votes
0answers
200 views

Save, update, get and sanitize post meta as HTML not plain

My post meta always is plain text HTML striped from it I need to Save, update, get and sanitize post meta as HTML not plain here is all my related code to this post meta filed Retrieve from ...
1
vote
1answer
274 views

Are multiple values from get_post_meta guaranteed to be ordered?

You can create multiple rows in the postmeta table for a post with the same key, like this: add_post_meta( $post_id, "example_key", "value1" ); add_post_meta( $post_id, "example_key", "value2" ); To ...
0
votes
0answers
22 views

How to get post that has non zero or greater than zero meta value

How to get post that has non zero or greater than zero meta value $args = array( 'sort_order' => 'asc', 'sort_column' => 'post_title', 'hierarchical' => 1, 'exclude' => '', 'include' =>...
0
votes
1answer
164 views

get_post_meta producing white screen of death

I’m using Divi, and added the following code below the post content in single.php: <?php if(get_post_meta($post->ID, 'store-url', true) !== '') { ?> <div class="store"><a href="&...
0
votes
1answer
35 views

How i can extract data

Hello i have form with nested repeater field, all data in nested repeater group saving in database like this: a:6:{i:0;a:4:{s:5:"title";s:21:"Initial ";s:11:"description";s:78:"Please show identify.";}...
1
vote
1answer
430 views

Header: Include Date Published and Date Modified

I'm trying to put the Date Published and Date Modified into the meta tags of the head of the header.php page - so far no luck. This is what I currently have: <meta name="date" content="<?php ...
1
vote
1answer
235 views

How to create a shortcode to print specific values stored in a post meta array?

i am having problems printing a specific value stored in a post-meta array in a WordPress loop created by a Visual Composer Grid Builder, thru a shortcode (i also tried the grid builder Custom Field, ...
0
votes
2answers
62 views

Data not displaying in text field

I have been working on trying to get data to store and display on a CPT field. The code I have is here: function fhaac_subject_box_callback( $post ){ wp_nonce_field( basename(__FILE__ ), '...
0
votes
1answer
2k views

Submitting Custom Post Types with custom fields from Front-end form

I'm trying to have a custom type post with 2 custom fields. Now I have the working custom post types and working form at the front-end via a template page. The problem is I can not get the custom ...
0
votes
1answer
379 views

How to show custom field on specific custom post type posts only when filled

On my demo website i would like to show some custom fields on posts of specific custom post type. And if possible only when they have a filled in value. Demo site: http://www.jsfaber.nl/gibson-eb-2014-...
0
votes
1answer
106 views

How to extract data from a post meta

What is the best way to extract the information from the database using get_post_meta? field name = invoice_details value = a:20:{s:15:"price_per_night";s:3:"150";s:12:"no_of_nights";s:1:"1";s:23:"...
0
votes
1answer
400 views

get posts meta query returning the latest post if no meta key found

I have this pretty standard script that looks for a preview or a report (custom post types) which have data stored against them (serialized array) taking the form of a guid. The guid is present on ...
1
vote
1answer
406 views

How can I get my iFrame to work with url from post_meta?

I've made a custom meta box for adding an URL to the post, which can be displayed later on the frontend page. This url is inserted in my database correctly. Then I'm getting the url in my code by: &...
1
vote
0answers
264 views

Run Shortcode of post's custom field in functions.php / Plugin

After 3 or 4 hours of searching the web for a solution, I abandoned it and hopefully you can help me? I added a sub-headline as a custom field (subheadlineclass). That works pretty. I can save, edit ...
0
votes
1answer
151 views

Unable to get specific value from post meta

I am using get_post_meta() to retrieve a custom meta field value from a given post. The custom meta box has a parent checkbox which has 3 child checkboxes. I want to get the values of both parent and ...
3
votes
1answer
133 views

Meta tags in shortcode

The thumbnail and title shows up as it should, but the post meta displays on the top of the page. What is the correct code for retrieve the post metadata? function evasmat_posts_shortcode(){ $q =...
0
votes
1answer
176 views

Sending mail not working correctly

SITUATION I have a reserve system for a restaurant and I'm trying to send data out of my wpdb to myself with the mail() function around 3pm. So I get a overview of all the reservations for the current ...
0
votes
0answers
83 views

How to get a post meta value and pass that to update_option when a post is created or updated?

When a user publishes or updates a post I want to get a post meta value from that post itself. Then I want to use update_option() to pass that value into the get_option() name. I've been trying ...
0
votes
1answer
78 views

do_shortcode based on _thumbnail_id

Situation I've created a Custom Post Type called 'Banners'. On each post I'm able to add a featured image. This will be saved in my database and will get an _thumbnail_id. Also on each post edit page, ...