Questions tagged [post-meta]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
34 views

Cant create or update meta fields using WordPress REST API

I have wp theme with custom fields in posts with following meta keys in photo, can't create post with custom fields values using rest-api (I'm able to create posts with no problem but cant edit or add ...
user avatar
  • 1
0 votes
1 answer
19 views

Filter posts by meta key

I would like to implement a search function where a user can enter an amount($amount) and based on that argument the search result needs to show all posts where $amount >= loan_min (meta key) AND $...
user avatar
0 votes
0 answers
16 views

Related Post Category Filter

How can I set a category filter for the related posts display so that a certain category is not displayed? here is an example link: https://bit.ly/3zNSoso the category with the id 390 should be hidden
user avatar
1 vote
1 answer
77 views

Update post meta custom field using block editor

I have a custom mapping plugin that (among other things) saves/updates coordinates to a custom field when the user drags a map marker within a custom block. Everything works as expected except for the ...
user avatar
  • 43
0 votes
1 answer
56 views

How to properly use oneOf and anyOf in Rest Schema?

I have asked this before at Stackoverflow, now I'm here to be more wp specific and bring more context - as I did some advance on this. Seeing this use of oneOf has made me change my schema to this ...
user avatar
1 vote
1 answer
38 views

Generate metadata for cloud images

The current situation We use the AWS SDK for PHP to store media files on S3 instead of the server's local storage, and use the wp_handle_upload filter to point the inserted attachment to the S3 file ...
user avatar
0 votes
1 answer
29 views

Add post's category as a meta tag to the post

For tracking purposes, I need to add a meta tag to each blog post with the post category it's in. The meta tag would need to look like this: <meta name="category" content="politics&...
user avatar
3 votes
0 answers
65 views

How do I manage custom meta in post revisions in the Block Editor era?

Note to admins: I have been trawling every possible resource for this but cannot find a good answer for modern WordPress, so please don't mark this as a duplicate of ("insert some answer from ...
user avatar
0 votes
1 answer
20 views

Display current ranking of post as a number in post title

I have a page where people can rank stuff. My posts are ordered by the current ranking which is stored as a meta key in post meta. Now i want to add the current ranking spot within the title of the ...
user avatar
0 votes
0 answers
19 views

Search post overlapping dates - meta_query with meta_key

I'm having a search form for rentals that search locations available according to a date range. For now, I store all reserved dates for each posts as post_meta. For exemple ; post_id: 231 post_meta : ...
user avatar
0 votes
0 answers
17 views

Custom fields for post or terms which don't update on post update

I need to have custom fields for each post and terms. But how can I create these fields which don't update when post or terms is updated in backend. For example: Lets suppose we have a custom field ...
user avatar
0 votes
0 answers
15 views

Why does "updated_post_meta" did not fire when uploading media other than image?

I am testing out the "updated_post_meta" hook by uploading items to media. I have notice that the hook is not firing if I am uploading files other than image. So I check the post_meta table ...
user avatar
0 votes
1 answer
62 views

Meta field bulk editing no longer working in WP 6.0 [closed]

Until recently, I was using the following PHP and jQuery code for adding bulk editing support for a meta field (price) in a custom post type (Book): PHP: function show_bulk_edit_book_metabox( $...
user avatar
  • 1,637
0 votes
1 answer
23 views

Conditionally run function based on custom meta value?

I’m looking for a way to conditionally display an image within certain Woocommerce hooks that I choose based on whether a value is true within a custom meta field for the products on my site. For ...
user avatar
0 votes
1 answer
46 views

What snippet do I need to type to show my ACF field show up on my theme?

I've been trying all kinds of things but I can't get it to work cuz my Theme single.php looks different that usual. I made a field in ACF named Region and then enter for example USA which I need to ...
user avatar
0 votes
0 answers
24 views

Insert Custom Field Value

I want to insert custom post type with it's custom fields values I have found this method to insert custom post type but with no custom fields wp_insert_post( array $postarr, bool $wp_error = false, ...
user avatar
0 votes
0 answers
24 views

How to save HTML data into SQL post_content column

I have a custom template file containing some HTML tags and get_post_meta function. I want to insert the HTML data into post_content column. Is there a wordpress function or SQL function to save into ...
user avatar
0 votes
1 answer
22 views

delete duplicates wp_postmeta

I'm looking to cleanup wp_postmeta. I've found dozens of duplicate entries. I've spend about 8 hours looking through topics and trying code and plugins to no avail. The most useful article on the ...
user avatar
  • 1
0 votes
1 answer
23 views

Format meta_value [closed]

I have a request to get postmeta records with a specific meta_value. global $wpdb; $result = $wpdb->get_results ( " SELECT * FROM $wpdb->postmeta WHERE $wpdb->postmeta.meta_key LIKE '...
user avatar
  • 3
0 votes
0 answers
16 views

How can I query for posts using a date stored in post-meta?

I’m working on a games release feature for a website I’m building. So far everything is going smooth, but I’m stuck on one area. For the listings on the front end, I want it to look at the “...
user avatar
  • 119
0 votes
2 answers
24 views

Next/Previous Product with custom order by price & products inside the product category [closed]

How to create next/prev buttons that are price sorted and give results inside the product category you are in? This question has been asked multiple times and despite the multiple threads there wasn't ...
user avatar
0 votes
1 answer
17 views

Is there a way to make [Table Of Content] plugin while not using revision data?

I have a problem while using TOC plugins 'cause all of TOC plugins use revision data to recognize header tag. I'm using my own metadata (custum field) plugin and the data doens't show on the revision ...
user avatar
0 votes
0 answers
22 views

Why is $_POST empty when saving custom Meta Box?

I'm creating a Meta Box in my custom Plugin where the Administrator can select which users can view a certain post based on their roles. When I select the role and save the meta box content by ...
user avatar
0 votes
1 answer
20 views

How to check post meta isset or not empty during publish/save post?

How to check if a specific post meta isset/!emtpy during updating or publishing a post ( save_post() )?
user avatar
0 votes
0 answers
17 views

How to avoid saving empty data to sql while using add_meta_box

I'm trying not to save empty data (null) while using add_meta_box function. My code is /** * Register meta boxes. */ function hcf_register_meta_boxes() { add_meta_box( 'hcf-1', __( 'Hello Custom ...
user avatar
0 votes
2 answers
52 views

How do I check if an article is popular this week?

I use this function to set and get post view of post in my WordPress function wpb_set_post_views($postID) { $count_key = 'wpb_post_views_count'; $count = get_post_meta($postID, $count_key, ...
user avatar
0 votes
1 answer
24 views

how to show records that don't have custom meta value

Running pre_get_posts, I want to order the items by a custom meta value. The problem is that by default this doesn't exist. Only if a user performs a certain action does the meta key/value get added. ...
user avatar
0 votes
0 answers
122 views

SQL query - get a featured image's alt / alternative text

I am writing some SQL queries to get post data out of a database for certain posts (so WP functions are not an option). I am trying to get post IDs, post URLs, post featured image URLs and associated ...
user avatar
  • 31
0 votes
0 answers
44 views

How to change text color depending on the number value (Using javascript)

I'm trying to change text on the table depending on the meta value I give (number). if meta value >= 7, number text on table changes to green. else if meta value >= 4, number text on table ...
user avatar
0 votes
1 answer
48 views

how to get serialized post meta

I have posts that have video content and these videos stored in database like this (serialized) a:1:{s:9:"video_url";s:0:"";} This serialized data have post video urls but can ...
user avatar
0 votes
0 answers
7 views

Compare User meta_value with Product meta_value

In Wordpress I've added a new field called "user_branche" on the user edit profile page within the admin. On the Woocommerce product page in the admin I added a meta field called "...
user avatar
  • 113
1 vote
0 answers
14 views

Using hook to use DISTINCT in a wp_query

SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) INNER JOIN wp_product dg ON dg.post_id = wp_posts.ID AND ( dg.location IN ('XV', ...
user avatar
  • 11
0 votes
1 answer
22 views

Save all the post tags inside a custom field

I'm having some trouble to add_post_meta using the code below with all the post tags inside a custom field. The code works to echo all the tags, but not for saving them because it only saves the first ...
user avatar
  • 299
0 votes
1 answer
94 views

update post meta value with other post meta value

I'm a beginner in wordpress / php trying to learn. I want to use the update_post_meta function to populate one meta value (X) with another meta value (Y) everytime Y is changed. I did research and ...
user avatar
0 votes
0 answers
31 views

get value from get_post_meta then reuse it in another get_post_meta

I am writing the following code, which I have updated since the original question so as to give the entire picture. I am a newbie, and the reason why I am not using the get_posts() function in ...
user avatar
0 votes
0 answers
15 views

Hide title field of selected post-types on edit pages

My question is how to hide the title field on the edit page of a cpt that has a title field here hide litteraly means do not display or do not show, or do not offer the possibility to be edited "...
user avatar
0 votes
0 answers
11 views

I can not display meta value in extras.php and template-tags.php

I have page template that stores reservation input fields, I would like add link to that specific page using meta box but my meta box doesnt work in extras.php and meta-tags.php, I would like to know ...
user avatar
1 vote
0 answers
28 views

How do I create an archive page as a <table> including metadata?

I'm really struggling getting this seemingly simple thing to work. I have a list of "vendors" as a CPT. They have metadata like "contact name" and "last invoice date". I'...
user avatar
0 votes
1 answer
33 views

update_post_meta() updating nested array in Multidimensional array with empty sub-array

How can i update/remove/empty a sub-array on user post submission in admin area? here ist the reference on how to update nested array i am using but it is not working if ( $post->post_type == '...
user avatar
0 votes
0 answers
14 views

WordPress CPT Taxonomy Dashboard Search - How to include taxonomy in search?

I am having great difficulty extending my Custom Post Type (CPT) with custom taxonomies to have taxomonies that are searchable when viewing the posts in the WordPress Dashboard. The CPT's and ...
user avatar
0 votes
0 answers
22 views

update_post_meta not working well

I need help with this I am using update_post_meta to update some custom field for post type and it doesn't work and that the code in the theme script file jQuery(document).on("click", "...
user avatar
0 votes
0 answers
16 views

How can I change author of posts to the value of one of the custom field of the posts?

I have a custom field in every post which contains the url domain name the post is scraped from, I want to assign this value, i.e. the url domain name, as Author of the post and not the actual user ...
user avatar
0 votes
0 answers
43 views

Post Thumbnail missing when using webp format while sharing

I have a problem when I upload a featured image for my post in jpg format, I get the featured image's thumbnail while sharing my post through any kind of messenger e.g whatsapp etc. But when I try to ...
user avatar
1 vote
0 answers
17 views

Plugin with action 'save_post' needs to press publish twice on order to publish

I have an old plugin, which used to work fine (years ago). Now I have to press publish twice to publich the post. The problem is in the blocks below. The used variables are declared above the code ...
user avatar
  • 11
0 votes
0 answers
12 views

Custom Post Type meta data getting deleted on bulk editing taxonomies

I am facing a weird issue while editing custom post types. I created a Custom Post Type and a taxonomy linked to it. Posts are attached to their respective taxonomy terms. I also added some meta data ...
user avatar
0 votes
1 answer
31 views

get specific values from WordPress meta_value

a:1:{s:9:"toys_item";a:1:{s:16:"toys_item_ranger";a:11:{i:0;s:31:"2 x Seadoo GTX 230/IBR Jet-Skis";i:1;s:30:"1 x HD Runway 10′ Waterslide";i:2;s:14:"4 x F5 ...
user avatar
0 votes
0 answers
16 views

Post Publish date not display on Umaya Child themes

I can't find out the option of published date or modified date on my blog post. I write the this code <?php echo get_the_date() ?> but can't display the date. this is my blog post where I try to ...
user avatar
0 votes
1 answer
12 views

How to merge the array values in foreach?

I have tried to get the checkbox values from postmeta field but cant merge the array into single result $get_info_contact = get_post_meta( $result, 'wpcf-society-info-contact', true ); $combined =...
user avatar
  • 11
0 votes
1 answer
61 views

Use wp_handle_upload outside of a POST

I'm writing a script that will prefill my custom post type with posts. Each post has a file (zip or json) as post meta that has to be uploaded to the media folder. The problem is wp_handle_upload ...
user avatar
0 votes
0 answers
15 views

How to merge the database results into single result?

I have tried to merge the result into one value inside an foreach value loop. I have to show the first name and last name values into single td column Array ( [0] => stdClass Object ( ...
user avatar
  • 11

1
2 3 4 5
40