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

learn more… | top users | synonyms

1
vote
1answer
8 views

How to update single value in multi dimensional Post Meta?

There are some values in Post Meta Data stored as a multi dimensional array. I want to update some of their data. Here is the Post Meta value displayed using <?php the_meta(); ?> voter: a:1:{s:...
1
vote
1answer
18 views

Move value of one custom field to another

I've one custom field named as "video" and I want to copy the custom field value to my another custom field named as "theme2035_embed." I could do it manually, but since I have more than 2500 posts ...
0
votes
1answer
20 views

add_post_meta doesn't work

I tried this on localhost and it worked, but then I tried to run this on live server (the same template, everything) and it doesn't work. Any help? add_post_meta('39', 'overall', '4');
0
votes
0answers
17 views

Transform post publish date fetching code into i18n format

I'm using Visual composer and I have a grid element which shows post date. The problem is - it is showing in English, while the site is in Bulgarian. I think I need to fetch the date in i18n format: ...
0
votes
1answer
17 views

Can I save post meta programatically without setting metaboxes?

I want to know if is it required to have metaboxes set to save post meta into a custom post type. I have a couple of pages where I save metadata into a post programatically, using add_post_meta, but ...
0
votes
1answer
31 views

Reset/delete post views meta/custom field after X hours or minutes or seconds

There's lots of snippets and plugins that will count post views but I'm trying to find a way a way to reset the number of views back to zero after X hours(or minutes or seconds or whatevaaaa). I'm ...
0
votes
0answers
9 views

Save and return input type is text on custom post type

I've got the following problem, and have been looking for way too long to solve it. I've made my custom post type, and custom taxanomies, and those all work great. But now I want a custom fields to ...
0
votes
2answers
47 views

Querying Database with wpdb

I am trying to access a single value from my database through my functions.php. I have tried three different ways to get a result using a dynamic ID and none have worked. I always get NULL as the ...
0
votes
0answers
12 views

Twentysixteen theme single post category display

Our site uses the twentysixteen theme and some posts are listed in more than 1 category, eg. Events (parent) & Skateboarding (sub category) Can anyone help me so the single post displays only the ...
0
votes
0answers
12 views

Add custom field on the page post-new.php

I've made 2 new custom collumns in my MySQL DB in the wp_post table. And i would like to insert there some text which i will take it from a textfield insite post-new.php As far as i can see, i have ...
0
votes
1answer
17 views

Get Post ID within wp_set_comment_status hook

I am trying to update meta_value whenever I manually approve a comment inside the WordPress dashboard. I could not figure out how to do it dynamically, but it is working when I manually add a post ID: ...
0
votes
0answers
19 views

How can I get post meta data (custom field) from within a custom wordpress action hook?

I have a custom hook in my theme which is set up like this: do_action('my_custom_hook'); That code is in my header.php file and outside of the main loop. I have a call to this hook like so in my ...
0
votes
0answers
5 views

Theme only saving post fields set by the author

I have a theme I'm customizing and every time I try add my own post field (meta data) nothing gets saved yet the fields set by author do. Is there something I'm missing or are there any restrictions ...
2
votes
1answer
33 views

How metadata API works?

Update 2: Check out @NateWr method using add_post_meta with the default post: add_post_meta( 1, 'my_items', 1 ); add_post_meta( 1, 'my_items', 2 ); add_post_meta( 1, 'my_items', new \stdClass ); ...
0
votes
0answers
12 views

Delete single meta row from multiple meta rows under same key of a post

I'm storing meta data for my posts using a single key, so it's creating multiple meta data. <?php $data = array( 'user_id' => $user_id, 'message' => $message ); add_post_meta( $post_id, '...
1
vote
0answers
35 views

Get registered custom fields or post meta even if empty

I would like to be able to get all registered custom fields or post meta for a given post. The limitation I am facing is that the use of either get_post_meta or get_post_custom returns an array of ...
1
vote
1answer
10 views

Update attachment metadata fails

Updating attachment title and description metadata with wp_ajax breaks all previous datas and structure of attachment, my php code: add_action( 'wp_ajax_update_attachment', '...
0
votes
0answers
21 views

WP Meta Query at depth 2

I'm interested in doing a meta query according to some post data that doesn't exist at the first level of the post meta. In other words, I would need two or more keys to get to the variable I'm ...
0
votes
1answer
11 views

Custom Media Meta fields to alter the generated image HTML that is inserted into a post for my animated GIF image player?

I want to add the capability to integrate a JavaScript animated GIF image player. It basically will load a cover image for the animated GIF on page load instead of downloading the larger animated ...
5
votes
2answers
58 views

Checklist of selected categories

On my blog I have a large number of categories >500, so I need to have some kind of checklist which categories are already selected to continue selecting. For example, if we have cat1, cat2, cat3......
0
votes
1answer
34 views

Display posts with empty custom field

How to list post with specific custom field which is empty? I have some posts with custom field 'author', and for some posts that custom field is emty, so I would like to find those posts to delete ...
0
votes
0answers
26 views

Sharing tables between 2 different websites based on the same database

I have 2 different websites installed on the same database. The 2 websites are sharing the users tables, but I want them to share the posts tables too. I tried to do it by editing wp-db.php. After ...
1
vote
1answer
29 views

Archive post by meta value + 24hours

I'm using this code to archive some custom post type : $where .= " AND wp_postmeta.meta_value >= now()"; The metavalue is a date field. On the day of the value of the datefrom has been setup the ...
0
votes
1answer
39 views

Automatic blog page with custom design [closed]

For my website, I would like to make a new section that looks like this: [] = a row {} = a column [{Image of post} {text of post}] [{text of post} {image of post}] [{Image of post} {text of ...
0
votes
0answers
26 views

Grabbing data from Meta Box

I am using someone elses code for uploading files to a custom post type, and I need to be able to get the URL back from it. In the editor, the value is the URL so that isn't an issue, but I need to ...
2
votes
0answers
27 views

publish_post action hook doesn't give post_meta_data

I write the following function to get the post data on publish post but i see that post_meta is not available, its always empty. How do i retrieve the post meta data of a post on publish_post hook? ...
0
votes
1answer
34 views

Creating Ordered Query using Meta_key

I've hit a massive roadblock that I've been stuck on for days now, hope someone can help with this. The problem: I have a custom field called order_value with the values road, air and bus. I am ...
1
vote
1answer
35 views

Attaching taxonomy data to taxonomy with wp_insert_post

By WP User Frontend I create a registeration form with some checkboxes, and use wp_insert_post and update_user_meta for create a new post (post type pavilion) on user registration.I want when checked ...
3
votes
1answer
21 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
1answer
34 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?
3
votes
2answers
128 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 \plugins\rest-api\...
1
vote
2answers
15 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
24 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
40 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
87 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
1answer
25 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); var_dump($...
0
votes
1answer
33 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
28 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
27 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 helper(...
0
votes
1answer
45 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
57 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
27 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
12 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
63 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
29 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
85 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
11 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
24 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 $...
9
votes
2answers
114 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
20 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 ...