Post meta is a data set containing additional core as well as custom post information.

learn more… | top users | synonyms

0
votes
0answers
5 views

Custom field value based on other custom field values

I have a custom field value called points. Post 01 points = 5 Post 02 points = 10 Post 03 points = 8 I need to create another custom filed value called rank. Rank custom filed value should be ...
0
votes
0answers
15 views

WooCommerce how to get attribute slug by variation id?

Is there a function to get the slug for a given variation_id? In the wp admin back-end: For a custom post type I'm able to attach a related wooccommerce product to the post through a custom field, ...
0
votes
1answer
28 views

How to hook into <head></head> container

I want to add my own <meta /> tag inside the <head></head> container on every page or post within the loop(). Is that possible? What hook(s) should I use for that?
0
votes
0answers
16 views

Using Flickr Images in wordpress

I am trying to use Flickr as my image hosting service. When I am writing a blog article, I have no issues embedding Flickr images but when I'm working on something like a recipe that doesn't provide ...
3
votes
2answers
47 views

How to get custom post meta using REST API

I am trying to create a REST APIs for my wordpress website which is used for facility listing using wordpress job manager plugin. I have registered my custom post , taxonomies in ...
1
vote
1answer
12 views

Add a meta value if admin , editor or any other user have open a post in edit mode

In my application user can publish a custom post from front end . And later admin or capable user can update or delete the post . What I want to do , is to determine if that post is seen by admin or ...
0
votes
1answer
19 views

how to get postmeta info based on multiple categories?

I need to get one meta_value from wp_postmeta and I can do it with one category but I'm having problem when using another one. I have: SELECT wp_posts.ID, wp_postmeta.meta_value FROM wp_postmeta ...
3
votes
2answers
35 views

Add post meta based on another post meta value before publish post

I want to add a meta value to my post , which will be based on another meta value , before publish post . This is what I have tried add_action('save_post_my_custom_post', ...
1
vote
2answers
39 views

Mass importing json data into custom fields (postmeta)

I am in the process of importing large amounts of data into a custom post type that has several custom fields (postmeta fields created by Advanced Custom Fields). I am using the following function to ...
0
votes
0answers
24 views

Cast woocommerce events date meta_value with wrong format in WP_Query

I'm using woocommerce events plugin to sale tickets in a client site. The client wants to display the next 3 events after today in the home page. I have created this code: $args = array( ...
0
votes
1answer
21 views

Saved Post Meta Array Returns as String

I am saving an array in post meta using update_post_meta. $arr = array('this', 'or that'); update_post_meta($post_id, 'field', $arr); $ret_arr = get_post_meta($post_id, 'field', true); ...
0
votes
1answer
23 views

Removing Meta Generator

I've noticed in the source of my page is shows in the meta generator Wow-Themes.com. I have been trying to remove this from the source using function rm_generator_filter() { return ''; } if ...
0
votes
1answer
23 views

Displaying multiple URLs as custom field values

I have been trying to figure out to display multiple custom fields with the same value and do not display them if there is no value entered. This is the piece of code I'm currently using and it ...
1
vote
1answer
26 views

Trying to remove post thumbnail with plugin

I have a plugin that need to remove the post thumbnail under certain conditions. Tried to hook to "get_post_metadata" filter but the code doesn't seem to work. Here's my code: public function ...
-1
votes
0answers
15 views

Two different meta and its different meta value compare with current and till next seven day Query

I want my posts display with current date or upcoming seven days date of birth or current date or upcoming seven days date of death. My current date work with following code and my date formate is ...
0
votes
1answer
29 views

Problem with saving large amount of data in postmeta/usermeta

I am facing issues saving large amount of data in post meta field e.g. I have created a field Bio/description and put a huge amount of text in it. Now when I save it, it saves some of the text and ...
0
votes
1answer
31 views

How to show Published date and/or Modified date

My code is based on the underscores reference theme. I have a posted_on function as follows: function example_posted_on() { $time_string = '<time class="entry-date published updated" ...
0
votes
0answers
20 views

Storing a many to many post type relationship in post meta and keeping SQL ability for Joins

I have 2 Custom Post types and i am manually keeping a relation between them in a many to many relationship by keeping an array as a custom field. All PARENT post types have ONE filed in wp_postmeta ...
0
votes
1answer
11 views

Exclude category from DB query

I have next code: $drivers_all = $wpdb->get_results("SELECT DISTINCT meta_value FROM wp_postmeta WHERE meta_key = 'driver'") With this one I get the values of all fields “driver”. How can I ...
3
votes
1answer
52 views

Will a large postmeta table slow a site down?

I have created a hit counter that stores all time hits and daily hits. This means that if a single post gets at least one view a day it will have 365 meta fields added to it by the end of the year. ...
0
votes
0answers
20 views

Use $wpdb->get_results with filter based on array

I need to filter my SQL query (in a plugin) based on an array of meta_values. I have CPT-A which is related to CPT-B. I am keeping an array of CPT-A ids in meta_key afz_entry_tags of CPT-B I need ...
0
votes
3answers
53 views

Custom search for custom post meta with pre_get_posts interferes with WP search

I'm making a custom post meta search with the pre_get_posts function in my Divi child theme functions.php file. The problem is that the final query gathers not only the results for my custom post ...
0
votes
1answer
9 views

Problem with adding custom post type meta to header by plugin

I'm trying to write a plugin by which a meta code will be added to specific post type header. I tried to use this code: function msc_header() { if ( is_singular( 'article' ) ) { echo ...
0
votes
1answer
23 views

Is it possible to retrieve all posts with a certain value for metadata?

Under 4.5, I have posts with meta_key as series and meta_value as 19, 20, etc I am trying to loop through them in a template, and I guess I'm a special kind of dense. Most recently I have tried ...
6
votes
0answers
52 views

Wordpress retrieving meta data for all custom post types in list view

Im having an issue in WP where php is dying, ive increased memory but the process jumps to 100% cpu usage then dies and apache throws a 500 error. Ive tried to get apache to log something, or php / ...
0
votes
0answers
13 views

Does get_post_meta result in a database query each time?

I want to add some new functionality to a post type. It is going to result in a dynamic number of meta fields. I want to know if i could consolidate the content into a single field (messy) or to ...
0
votes
1answer
28 views

Custom meta is not being saved

I have created the following class in order to add a custom metabox for my posts, but the data is not being saved. Anybody can say what's wrong with my code? class Anotai_Meta_Box { public ...
0
votes
0answers
25 views

Missing Post Meta and '0' value or meta ID

I have a custom plugin that saves metadata to the DB and has been doing so for months. All good. My latest issue is that post_meta values are disappearing (post title, content and taxonomies seem to ...
0
votes
1answer
40 views

WP Meta Query for some meta (array) values

If I get my posts using meta_query by 'my_meta_key' only I get something like this Array( [0] => Array( [nested_key1] => something_I_want1 [nested_key2] => ...
0
votes
0answers
64 views

How to show twitter link preview (Card View)

I want to ask about my problem. I can't show twitter link preview for my website and for information, I just add this code i get from WP Beginners <?php #twitter cards hack if(is_single() ...
0
votes
2answers
42 views

Where does the actual data stored by add_post_meta

I am pretty new to WordPress API, loving it btw, I have a small project, adding a like button to the end of every post, pressing it makes user like the post, button changes to dislike, pressing again ...
1
vote
4answers
90 views

How do I query for posts by partial meta key?

I have a function that stores the "like" status for a post as post meta. I want to associate that "like" with the user that liked it, so I setup a custom field called "like_status_{user_id}" (where ...
0
votes
1answer
25 views

How to check widget-cpt meta and display its custom css in the head?

When dealing with a widget that is a custom post type, is there a way to detect when that widget is displayed, then check its post meta for any custom css and enqueue it in the head of the site? ...
0
votes
3answers
49 views

is_main_query() never called on WP 4.4

Im fairly new to WP dev, however as far as i can see ive followed the correct procedure in my custom archive page (below). If i remove the check for is_main_query() it wipes the menus out and likely a ...
0
votes
0answers
35 views

Why are my custom metaboxes not updating the post meta?

It works fine when creating a new post, but nothing happens when I edit a post. What am I doing wrong? function imgw_save_contest_meta( $post_id, $post ) { global $post; if( ...
0
votes
0answers
41 views

How can I make my plugin display custom post meta data on the front end?

I have been googling this for quite a while but have come up with nothing. I am writing my own plugin and I need to display custom post meta fields on the front end on the archive page. How can I do ...
0
votes
0answers
19 views

Custom Fields with pre-filled content

as this is my first post here I first of all like to say "Thanks" because I found a lot of hints here for my problems in the past. Now I have to ask for the first time: We are offering news under ...
0
votes
1answer
32 views

Batch update a post meta field value of each post in Post Type

I need some help on making a batch post meta updater I'm trying to add to my options/setting page. Basically I'm looking for a way to click a button a batch runs through all post of a selected CPT ...
0
votes
1answer
43 views

WooCommerce: Adding Order Item Meta Data That's Hidden

I was under the impression that if you add an underscore to your meta_key, it would be hidden from the Admin and subsequently the Order Receipts, etc. But, mine are showing? I don't understand what's ...
0
votes
1answer
51 views

Nested array issue in meta_query

I am using following meta_query to search blog post according to following search criteria, search logic : if expire date set, check the expiry of the post, otherwise just include it if ...
0
votes
0answers
32 views

add_post_meta only adding 1 character

I am trying to make a form that auto posts without needing to be signed in. So far I'm testing with dummy data, but I'm running into trouble with the add_post_meta part. It seems to only be adding 1 ...
0
votes
1answer
53 views

Best Way to detect unique posts in wp rest api

I am developing an android app for my WordPress blog. I have some bad trouble to detect and get post. So first I give u a vision from what I am into: I want to get post from past, so I do this: Get ...
3
votes
1answer
91 views

WooCommerce conditional meta query

For this question, I know how to solve it but I am hoping there is a better / faster way to solve it. I have a custom meta query in my product loop that doesn't display my product if the stock is 0, ...
3
votes
1answer
50 views

Can I count the number of users matching a value in a multiple value key?

I'm trying to find the number of users having a certain value in a custom field. The problem is that this custom field allow multiple values. This code works well when the meta_key allows only one ...
0
votes
0answers
26 views

Order by meta_value_num issue

I am using meta_value_num to get the list of teams by their ranking, it working fine in 1,2,3,4 etc position, but in case of 11th, 12th, 13th etc position it consider them as a second position, the ...
0
votes
0answers
19 views

How to avoid duplicate post entry admin page

I am building a cinema website with different custom post types. How do I avoid duplicate post entries? For example, I have a post type: Trailer First I add a trailer Terminator. After if I add ...
0
votes
1answer
58 views

Get the correct meta_value with get_post_meta

I tried using the function get_post_meta() to get the meta values of my posts. However to my surprise it returns an Array that contains again arrays! So I looked inside the second level array, and was ...
0
votes
1answer
22 views

show ad after # paragraphs

Trying to use ACF to determine when to insert an ad after # many paragraphs. Right now after 3 paragraphs the ad is inserted. if ( is_single() && ! is_admin() ) { $show_after = ...
0
votes
1answer
41 views

get_post_custom()

There's very little said about get_post_custom() in codex. I also couldn't find any good explanations or usage from G search. My current understanding is that it gets all the post meta related to the ...
1
vote
1answer
13 views

Randomly Assign an Image's Alt Text Based on Data From Post

I would like randomly assign an image an alt text based on taxonomy entered by the user on a post that the image is attached if there is no alt text entered. For example, on a post that has an image, ...