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

learn more… | top users | synonyms

0
votes
1answer
17 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
16 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
23 views

How to Add Meta Values in Loop?

I am using a category page to list various businesses on a website. These businesses have reviews attached to them through posts that contain their unique tag. I want these aggregated rating reviews ...
0
votes
0answers
18 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
15 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
15 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
18 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
37 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
11 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
34 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
41 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
17 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
30 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 ...
4
votes
3answers
423 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
43 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
21 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
11 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
30 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
29 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
16 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
26 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
36 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
31 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
19 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
52 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
22 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
40 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
25 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
32 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
52 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
55 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
9 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
39 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
60 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
33 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"), ...
0
votes
1answer
49 views

Can A Post Meta Field Store multiple values that are not in an array?

I have a post_meta field that seems to be displaying multiple values, yet they do not seem to be in an array. Using debug bar, this is what I see inside of the ...
0
votes
2answers
55 views

Wordpress custom post type

hello i have post_type "product" and taxonomy "price" can someone help me to query that custom post type with the selected taxonomy? my current code is like this <?php $term = get_term_by( ...
0
votes
0answers
22 views

Use more than one post meta inside the loop

I have custom meta like this: I want to select the post with both of these conditions are true for : 1- end_date = "some date" 2- st_date = "some date" Also I need it to select by title ...
0
votes
1answer
26 views

Metabox of one post influence setting on other

This great answer by David Gard allowed me to have a metabox sticky (checkbox) for posts that could only be set (checked) on one posts in the loop at a time. If post A has that meta box checked, then ...
0
votes
1answer
59 views

wordpress sorting using array merge by price in ascending order but price with 0 must be show last

I'm using below code to filter the query on page and sort the post in ascending order by price. I'm getting desire output but my concern is , i want all price with 0 at last. <?php global ...
0
votes
0answers
13 views

Displaying randomly created meta values in wysiwig editor

I have already asked this question on stack overflow but I'm asking it once again here because i haven't found a solution to it yet. I am creating custom meta info for a post that will have null ...
0
votes
0answers
45 views

Query postmeta values, and return multiple post_titles for common meta value

As of now I query the DB: global $wpdb; $query = $wpdb->prepare(' SELECT p.post_id, p.meta_value, pm.post_title FROM %1$s AS p JOIN %2$s AS pm ON ...
-1
votes
3answers
56 views

Custom Post Type meta value is being saved in array, instead of just the string (as value)

So, this is how WordPress is saving my CPT meta: array(8) { ["product_id"]=> array(1) { [0]=> string(10) "abcdefg987" } ["end_date"]=> array(1) { [0]=> string(10) "02-02-2015" } ...
2
votes
2answers
117 views

How to make custom post meta wp_editor translatable?

I have custom post type named soto_property in which I have added three wp_editor as post meta, using this code - wp_editor( htmlspecialchars_decode($valueeee1), 'propertyEditor1', ...
0
votes
1answer
30 views

Value of post meta dropdown is not showing in Wordpress

I have a select dropdown in my post meta in which I am getting post ids of all post of another custom post type. see below code- <select name="property_type" id="property_type"> ...
0
votes
0answers
17 views

Post Meta Checkbox won't save

I'm trying to use the script as per How set featured posts using checkbox in post edit screen? function register_post_assets(){ add_meta_box('featured-post', __('Featured Post'), ...
0
votes
2answers
99 views

How to sanitize select box values in post meta?

I have added a select box in the Post meta. Here is the code, and it works fine. My question is, do I need to sanitize the values before updating the post meta? If yes, how it should be done? This is ...