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

Questions tagged [post-meta]

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

1
vote
1answer
23 views

403 Error when text is pasted in Custom Metabox Textarea

I hope everyone is having a great day! I am creating this question as I have been stuck on this issue all day and I need some friendly advice. I have created a repeater custom metabox item for a ...
0
votes
1answer
29 views

Modifying post content with the_post action hook

I'm trying to understand the best way to modify the way that search results are displayed with my custom post type. I've got the search function working properly and giving the correct results and now ...
0
votes
1answer
27 views

How to display liked posts of current user in wordpress?

Im using an ajax like dislike post system on my wordpress theme. When the user likes the post there are some post metas to update or to add like the following: if( $post_like == "like" ){ ...
0
votes
1answer
54 views

How to add/update post meta to use in query?

I found a rating system that users can rate the post when commenting. Every thing is good but I want to use the average rating of posts to sort them to users based on average rating (in fact be able ...
0
votes
0answers
15 views

Generate post content from meta fields

I have a custom post type (match). Each posts on this CPT has one ore more custom fields. Is it possible to automatic generate the 'post content' with the value of my custom fields on these posts? ...
0
votes
1answer
25 views

Saving custom post types post_meta over REST-API fails

I try to save with wp-json my custom post types meta data but does not works in my case I create my custom post type with jjgrainger's class as it follows $arguments = array( 'public' ...
0
votes
0answers
20 views

How to properly get the wp_postmeta.meta_value of a custom post type in specifics?

In a RDMS with the following query I try to get postmeta.meta_value of the post with custom post type points. To identify which key they belong to I made a case when. This query returns a greater ...
0
votes
1answer
8 views

I need query_posts() to order results first by a meta value and then by post ID

I've read all the WordPress docs that seem relevant, and I've read lots of posts here and on other sites to find an answer to this, but I still can't find a way to do this. I have a custom post type. ...
-1
votes
0answers
17 views

how do I add an article to the title?

function __search_by_title_only( $search, &$wp_query ) { global $wpdb; if(empty($search)) { return $search; // skip processing - no search term in query } $searchTitle = $...
0
votes
1answer
27 views

Saving html into postmeta without stripping tags - safe?

I have a product description box, I want to add the HTML from the description as postmeta, for some outside reasons I can't unescape the code coming back out of post meta. Is it safe to just ...
1
vote
0answers
22 views

post meta parameter in post custom-post-type endpoint with restapi

I'm trying to create a new custom post via the native Wordpress REST API POST /wp-json/wp/v2/CUSTOMPOST at the moment I used the wp-rest-api-controller plugin to activate the endpoints the custom ...
0
votes
0answers
19 views

Get post content before rendering

I am currently working on a shortcode function, where I need to access the content of a post, before its rendering. If I do it like this $content = get_the_content( get_the_ID() ); It gives me the ...
0
votes
0answers
10 views

Best Practice to display posts which contain a certain metadata

I'm working on a theme that allows the user to add meta data to a post. I want to display all the posts with my custom meta data on a front end page. However I am unsure the best way to go about ...
0
votes
0answers
13 views

How do I get all authors posts of a custom post type outside loop

I'm trying to create a utility script that to add some metadata into all posts of a certain post type. Right now I have it set up to loop through all users $blogusers = get_users(array( 'role'...
0
votes
0answers
11 views

Meta box built with loop have 1 error in input

I am making a loop to build metabox with several inputs. It is working , but there is something strange happening. When loop runs. all inputs are working fine except one. always the same one. ...
0
votes
0answers
31 views

Is there any way to get all custom posts and all custom terms with it's meta in few queries?

I'm developing a website with a record for me query count. It has 720 Query for the main page. I want to reduce it. The main page structure is like this: ~10 Custom Taxonomy Term Each Term has a ...
0
votes
0answers
12 views

Order query by multiple meta keys

I want to order my posts by release_date and imdb rating but I cant make it to work. And yes I looked the other posts and still cant figure it out :/ This is the query: $args['wp_query'] = array( ...
0
votes
0answers
13 views

How do I create a navigation menu from product meta (custom fields)

I'm trying to find out how to add a navigation menu to my site based on one set of custom field meta data. I have tried creating tags from the custom field but then all tags are displayed in a single ...
0
votes
1answer
30 views

add action save post type and update post meta woocommerce

I want update post meta in product woocommerce when I save o update the product. I write this function (and insert in functions.php) with save_post_NAME_CPT but don't work. add_action('...
3
votes
2answers
83 views

Custom field metabox not showing in back-end

I recently updated my website after a while, and the custom fields meta box is not showing in the editor anymore. It isn't showing under "Screen Options" either. Any ideas why this could be, and how ...
0
votes
0answers
13 views

how to display data from toolset custom fields into wp_head as json-ld jobschema format only in CPT 'Jobs'

i am using toolset types plugin and genesis framework. i created custom fields for a CPT Jobs using toolset plugin. Now i want to display these fields data as jobposting schema json-ld format into my ...
0
votes
1answer
13 views

How to Disable option of meta field if that option is selected for any other post in custom post type?

I'm working on a custom post type with a custom meta field post type (like post formats). I'm able to save and retrieve the post according to the meta key values. But the problem I'm facing is how to ...
0
votes
1answer
38 views

Filter posts by meta data using custom query

I'm trying to filter post by two things. By the current logged in user. By meta data (disc_id) from the post. Note: The value for "disc_id" is a copy of the post ID from the custom post type it is ...
0
votes
1answer
45 views

copy attachments to another post type and change attachment url

On my site I have to custom post types and a function that let's users import photos from post type A to post type B, copying the meta values and it copy's the image to the folder specified for post ...
1
vote
1answer
17 views

How do I set all of a particular post meta to a value within the custom post type I'm in?

I've currently got a custom checkbox that (if checked) sets a particular post as 'featured'. It also set all other posts as 'unfeatured', just before setting the current post. This has worked great, ...
0
votes
1answer
38 views

gettext localization is not working

I'm trying to translate the post date using __() function. But it is not working. The post date still displayed in English. What are you the other options to localize the post date(posted-on). ...
0
votes
1answer
57 views

Can't translate the post meta data (Date) in another language

I want to translate the post meta data (date) in chines language for example, September 13, 2017, should be translated as 2017年9月13. But my code gives it in English. Do you see any error? Please help. ...
0
votes
0answers
21 views

Look for string in posts and postmeta

I have a query that finds the usage of an attachment in any post. $used_in_content = array(); foreach ( $attachment_urls as $attachment_url ) { $content_query = new WP_Query( array( 's' ...
0
votes
1answer
23 views

wp_insert_post inside save_post adds wrong metadata to inserted post

I have code for saving metadata for Student post_type. While saving metadata I also want to add separate posts for each payment in payments array: add_action( 'save_post', 'save_student_meta' ); ...
0
votes
0answers
12 views

make post pagination with image from meta post

i have gallery post , with value post is image from meta post , and i want make this post like this fiddle but i dont know how to make it , i was try use this code <?php while ( have_posts() ) : ...
0
votes
1answer
22 views

Add postmeta to all blog posts

I have a bunch of blog posts that I need to update with a custom postmeta key/value pair. Therefore I have two questions - where can I find the postmeta entries in a worpdress MySQL database and how ...
1
vote
1answer
37 views

How to filter into post meta data before saving

I'm on a plugin, where I want to provide a way to my clients to filter data before saving. I know the best way is to provide a filter hook. So I introduced a new filter hook to filter all the post ...
0
votes
1answer
13 views

How To Display Author Popup on Entry Meta (Genesis Framework)?

How to when the mouse pointer on the author name can display Author Popup like this site? https://www.dietdoctor.com/low-carb/keto Thank you!
0
votes
1answer
39 views

Post meta data not showing in frontend, until hitting 'update' button

I try to insert around 2000 video-posts into WP. There is a custom field in the theme for the video-url, so I add the video-url to the post meta data with the corresponding field name. ACF seems not ...
0
votes
2answers
34 views

How can I change the <head> tag contents of individual Wordpress posts?

How can I change the tag contents of individual Wordpress posts? I want to add a meta tag for keyword. I use Yoast SEO but even though I specify the focus keyword, no keyword is added in the meta ...
0
votes
1answer
21 views

Custom meta box data array: foreach not working correctly?

I have written a plugin to create a new custom post type named gardener, and have added a custom taxonomy called region, in addition to a meta box with several fields called _gardener_address. The ...
0
votes
2answers
247 views

How to check if Woocommerce Order number equals to post ID?

I am facing a challenge. I need to check if Woocommerce Order Number will equal Post ID. I know that this is true like 90% of times, but I need bulletproof way to check this. See example where this is ...
0
votes
1answer
52 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
0answers
13 views

Woocommerce - custom upload

My upload won't save images, and won't save list into field. It's a simple code but it just ignoring everything :) <form method='post' action='' enctype='multipart/form-data'> <input type="...
0
votes
0answers
29 views

Woocommerce - Saving parent product meta for children (in variations)

In 'new product page' i'm using custom meta fields. They're extensive and use custom functions to process data. Now in product type [variation] i need to take those meta fields which are coming from ...
0
votes
0answers
81 views

Creating a “Related Meta” type field?

I need a unique meta box which can contain auto-updating elements similar to how a tag cloud would appear. Example. identifier id : animals identifier data : Dog, Cat, Horse, Pig I need to know ...
2
votes
2answers
25 views

How to use a Term Meta Field as a link

I created a taxonomy called animal and a term meta field called horse. I created a function in my functios.php file to make it easier to display the data. Here is my code: function ...
1
vote
1answer
47 views

How do I have WP_Query match posts based on search parameter OR meta fields? (rather than search parameters AND meta fields)?

I'm trying to include post meta in the scope of a WordPress search using WP_Query. I have a meta query that looks like this: $args['meta_query'] = [ 'relation' => 'AND', [ 'key' =...
0
votes
1answer
23 views

How does WordPress treats attachments metadata in post content?

I understand that an "Attachment" object can have its own metadata in Media Library. However, it can also have it's own metadata in a post scope. How does WordPress deals with attachment metadata? ...
1
vote
0answers
19 views

Getting a Meta from Multiple Meta [duplicate]

i want getting a meta value from multiple meta i getting meta by : $data['cd_meta'] = get_post_meta( $p->ID, 'cd_meta', true); but cd_meta is a multiple meta and i need just one specific meta ...
0
votes
1answer
25 views

Wordpress creates new lines in postmeta table on post update

I noticed some weird behavior in WP. I've created custom fields through ACF Plugin. I've also coded a function that can update posts and custom fields at the same time with wp_post_update and ...
1
vote
2answers
35 views

Undefined Variable - Custom Post Type Meta

I've read many related questions and have tried all that I could so make sure it's actually a duplicate before flagging please. I've been using WordPress for about 6 years so when I say I'm stuck, I ...
0
votes
2answers
97 views

Display post number by category

I try to add auto increment post numbering by category. Like cat="myID" > post 1, post 2, post 3... Display post number not post ID number In find this solution, and use post_meta looks a good way. ...
0
votes
0answers
25 views

How to delete meta-field which is registered with register_meta to Rest API

I'm working on a Wordpress integration and updating our WP JSON api v1 to v2. We have custom post types which use two custom meta-fields. One of them should be preserved to the WP's database while ...
-1
votes
2answers
53 views

How to display the date under the post title?

He everyone i'm a newbie to wordpress/php and have 1 other problem. I am trying to get the date under the post title and not to display the category tags above the title. I tried it to change thing is ...