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

learn more… | top users | synonyms

0
votes
0answers
7 views

Filter query posts by the count of metas for a meta key

I know it is possible to filter queries to order posts by the numeric value of a meta. For example, I store the number of total likes for a post in a single meta key : ...
0
votes
0answers
10 views

Detect DOM Changes in Custom Metabox

I have a scenario where I use a custom metabox that contains two tables. One table contains a select list which a user can then add details about the selection. When complete, they click a button to ...
1
vote
0answers
17 views

How to compare two posts including their meta fields on a scalable base?

I have set up a wordpress in a way that posts can be cloned and be altered by a different author. whenever this is the case, i want the administrator to be notified via an additional tab in the ...
0
votes
0answers
10 views

help with wordpress post_meta saving and updating

i have this code which works fine, i can input information, save information, retrieve information no problem but if i want to erase an existing information to leave the field blank it will not erase, ...
0
votes
0answers
14 views

set s3 image as a featured image in wordpress post while posting the post programatically from an external source

I am pretty much new to wordpress. My requirement is that i need to make a post from an external source using ajax to wordpress site. The post data merely contain "posttitle,description,etc..." and an ...
0
votes
1answer
12 views

Save values generated via API as custom meta fields

I'm using the IMDB Connecter plugin to grab meta data for movies and I'm wondering if I can save some of the information it generates as custom meta data. Basically, I want to be able to save the ...
1
vote
3answers
28 views

Orderby meta_value only returns posts that have existing meta_key

I have the following wp_query: $args = array( 'post_type' => 'news', 'orderby' => 'meta_key', 'order' => 'ASC', 'meta_key'=>'custom_author_name', ...
0
votes
0answers
33 views

Undefined index error in custom post metabox

I'm getting this error with my custom post metabox. The custom post and metabox works fine, but if i have debug on and when i try to save any other page or post, i will get an error: Notice: ...
0
votes
1answer
32 views

Get $post->ID from a URL

I have a custom post type called music. I have created a custom template as a normal page to show some stats for the musicians. I have a page where they can see all there songs and have added a ...
0
votes
0answers
26 views

Meta query compare timestamp if exists

I have a custom post type with a start and end date timestamp. These fields are not required so they may not exist. What I want to do is query and show all posts that don't have the end date set or ...
1
vote
1answer
17 views

Safe to delete blank postmeta?

We have a lot of rogue custom fields. I feel that we can clear significant space in the DB if we remove the blank values. If I query my database with the following: select * from wp_postmeta where ...
1
vote
1answer
28 views

Custom post meta values reset by autosave [duplicate]

I have created a post view counter plugin that increments a count each time a post is viewed/refreshed. The count is working fine however if editing a live post the autosave functionality appears to ...
0
votes
0answers
22 views

Reduce or prevent calling of update_meta_cache

My theme calls the update_meta_cache() function 58 times per page! This function appears to run the following query based on the post in question: SELECT post_id, meta_key, meta_value -> FROM ...
0
votes
1answer
30 views

Change meta tags programatically

Is there a way to change the meta tags not in the head but in a template file through code? I would like to change the meta tags <meta property="og:title" content="title" /> <meta ...
0
votes
0answers
17 views

Define meta fields in a page template

I had an idea for managing fields for page templates and I thought I'd post it here to see if (1) this is terrible and (2) if there's a better way to define the fields in the template. Here's the ...
0
votes
0answers
25 views

Custom post type term names with ampersand in the term name

Every time I think I've got a handle on WordPress it finds a way to baffle me. Recently we've been having an issue with not being able to attach term names with an & (ampersand) character in the ...
1
vote
0answers
22 views

Custom filter function not working with Custom post type

I have custom post type "soto_property". I have made a custom filter to filter post listing according to used meta data named "operations". Here is my code- <?php add_filter( 'parse_query', ...
0
votes
1answer
22 views

use post meta in add_meta_boxes action

Is there any way to use get_post_meta within a function called by the add_meta_boxes action hook? I only want to display the meta box if a specific post meta matches a regex, but so far, I have not ...
1
vote
0answers
29 views

Storing revisions of metadata for custom post type

Storing metadata for custom post types is easy, you just need to add an action for 'save_post' with your method that handles this. In which you have then something like the following for a field that ...
0
votes
1answer
41 views

Read post meta values, only if posts are public

I want to retrieve meta_values applied to posts. Currently I execute the following query global $wpdb; $table = $wpdb->prefix.'postmeta'; $values = $wpdb->get_results( "SELECT meta_value ...
0
votes
0answers
7 views

Moving WordPress Featured Image Box Below Title [duplicate]

I would like to move the featured image box just below the title field in the New Post admin. I tried the following code, but that just places it below the text editor. function ...
0
votes
0answers
17 views

Update post_meta field only when present

Present update_post_meta internally calls add_post_meta if the value is not present. What i want is to avoid calling add_meta if the value is not present and the value passed is '' (blank). I do ...
0
votes
2answers
42 views

Get a post_id where meta_value equals something in a serialized meta_value field

I'm storing CPT products' post IDs into CPT companies' post meta (meta_key = prefix_products). As a company can have multiple products, so I'm storing them into a PHP serialized array value. ...
0
votes
2answers
43 views

How to selected which tags to print, instead of printing the whole tag list?

When having this: $tag_list = get_the_tag_list( '', ', ' ); I substituted the meta print: printf( $tag_list, $category:list, etc ); by this: $printArray_tag_list = explode(', ', $tag_list); ...
0
votes
1answer
21 views

wordpress custom loop ascending descending posts by custom field

I am developing wordpress site that is depend upon price so i add custom filed named 'price' <?php while ( have_posts() ) : the_post(); echo $price = get_post_meta($post->ID, 'price', TRUE); ...
1
vote
1answer
33 views

Difference between meta keys with _ and without _ [duplicate]

In wp_postmeta table I noticed that some of the keys are with '_' (underscore) prefix and and some are without _ What is the major difference between these fields and how they can be used while ...
5
votes
3answers
489 views

Why WordPress choose data serialization over json_encode?

In my little age with WordPress, I've seen WordPress itself and its friendly plugins are using PHP serialize() in storing data into db in many cases. But in a recent search I found a serious community ...
0
votes
2answers
65 views

Adding and updating repeating custom field meta data

I've got 20+ hours into this and could really use some help. Here is what I am trying to do.. For each record, add post meta. If the post meta already exists, update each field in the array. Just like ...
0
votes
0answers
12 views

Displaying meta via shortcode

So i added a custom post type and tax to my child themes function file and then added this for some meta i would like to know how i can get this info to display via shortcode? function ...
0
votes
0answers
26 views

I am trying to add custom-fields to a post carousel plugin

I have a post carousel on my website.I am trying to add an option to display custom fields. I looked at the code for the carousel and I tried to add my custom-fields option. I am not getting a display ...
0
votes
1answer
17 views

meta field search too restrictive in pre_get_post() for custom search

I'm trying to figure out how to loosen up a custom meta field matching string search in a custom search. Basically, if the meta field of a custom post has "Whistler Bike Park, Canada" and I enter ...
0
votes
0answers
34 views

Calculate top authors on the basis of Post Views

I wanted to calculate the Top authors on the single.php page according to the average of the posts views. I have created a function which is calculating the average of the total post views of a ...
0
votes
1answer
30 views

Assign postmeta in bulk

I have meta paramteres for my pages, which i would like to change in bulk (about 300 pages). I know that meta name is "header-settings" and values can be "no-data", "site-data" and "page-data" I also ...
0
votes
0answers
17 views

meta query always fails even if data is correct

I've following query - $query = array( 'post_type' => 'accessory', 'posts_per_page' => -1, 'meta_query' => array( array( 'key' => 'accessory-bike', ...
0
votes
1answer
31 views

Set default Custom Post Meta Value

I've tried almost anything and just can't get this to work. I have a custom post type with a custom meta field and I want a default value to be added on when the Publish/Update/Save button is ...
-2
votes
1answer
45 views

If meta_key exists then don't select this post?

I'm trying to select all posts EXCEPT ones with a meta_key somekey. SELECT * FROM wp_posts JOIN wp_postmeta ON wp_posts.ID = wp_postmeta.post_id WHERE meta_key != 'somekey' But this is still ...
0
votes
2answers
35 views

Wordpress altering my custom query, How to fix it?

I am querying for most popular posts by custom view count by using the custom query below, <?php $mostpopular_args=array( 'post_type' => 'post', 'orderby' ...
0
votes
0answers
22 views

Performace on 1 million plus meta fields vs 1 field with 1 million multi array

We are potentially looking into building a counter in a post_type. So a post meta field wil be created with some data like total downloads and downloads left (tied to user ID). We expect up to one ...
0
votes
0answers
63 views

Sorting Posts with meta value not working

I want to retrieve most popular posts based on 'view_count' meta value, the below code doesn't seem to work, I am getting some random posts, where am I doing it wrong? <?php ...
0
votes
1answer
26 views

Getting attachments by meta value

I'm stuck at a very simple point: I need to get all attachments by a custom meta key (and value). I'm developing a short code, so it has to work on every possible page. What I've tried so far: $args ...
0
votes
1answer
53 views

Adding meta data to an attachment post

I want to add a meta data to my attachment posts, so I can get them in order by meta value later. That meta value would be 'price'. So I thought this could work: I have this args: $args = array( ...
0
votes
2answers
37 views

Get posts ordered by meta data

I have a post type gtre and metadata price. The 'price' metadata I get using get_post_meta($post->ID, 'key', true)["price"]; So I don´t know how exactly should I write the args for WP_Query ...
0
votes
1answer
37 views

How to calculate the average of a post meta value(Numeric) of a specific author

I am having a website which is currently consist of multiple authors, Currently my website is having a module to count the total no. of views and i am storing this value in post meta as a ...
2
votes
1answer
56 views

Efficient way to save a lot of meta data

im currently developing a plugin that will read an external xml, and convert the data to a custom post type. Each post needs around 50-60 meta_fields. Right now im looping through each piece of needed ...
0
votes
1answer
31 views

Displaying a div from an assigned meta_value when on a page

On my website I created a custom metabox that is being displayed in the post type "page". The metabox will display a checkbox and 4 url fields. The checkbox will control the visibility of a div ...
1
vote
1answer
62 views

Get attachment by meta_key value

I need to get the attachment (will be only one per post) associated to a post with meta_key wpcf-legislacion-gratis (not matter the value the column has) by using a custom query using get_posts() ...
0
votes
1answer
15 views

Echo custom post meta from options array

The code below comes from: var_dump(get_post_custom($post->ID)). How can I echo the value of artist_seo_description from my PHP script? array(5) { ["_edit_last"]=> array(1) { [0]=> ...
0
votes
1answer
48 views

How to Update post status using meta data in Custom post TYpe

I have custom post type and have some some meta field it. I have a select field 'Publish' to change post status. if I set it 'yes' and click on Update button then post will be published and if i set ...
0
votes
0answers
70 views

Simple WP_List_Table won't return posts, let alone custom metadata

So, I am trying to create a simple WP_List_Table to return custom metadata from a custom metabox created by a plugin I developed. As of now, I haven't added any of the columns for the custom post ...
0
votes
1answer
40 views

Filtering by multiple conditions in the loop

I'm trying to filter the posts in my index by multiple conditions. So far I've tried with this: <?php $query = new WP_Query( array( "post__not_in" =>get_option("sticky_posts"), ...