Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

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
1 answer
5 views

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

This question has been asked multiple times and despite the multiple threads there wasn't an exact answer. Only relatively close ones that didn't do all of the above. Below you will find my answer ...
user avatar
0 votes
1 answer
15 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
20 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
13 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
14 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
44 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
23 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
83 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
26 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
31 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
  • 103
1 vote
0 answers
9 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
15 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
0 answers
22 views

get_posts - ORDER BY multiple meta key values

I need to order my pages by 'Department' first followed by 'Level'. These are both meta keys. Then level needs to be ordered by the predefined values of 'First, 'Second', 'Third'. How do I achive ...
user avatar
  • 79
0 votes
1 answer
20 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
22 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
19 views

WordPress custom search, search by meta key

I have a search form with two dropdowns showing custom terms and two text fields for custom meta keys, The search work with tax_query but meta_query has no result. Here is the pre_get_posts hooks ...
user avatar
0 votes
0 answers
10 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
10 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
25 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
19 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
19 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
13 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
27 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
14 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
8 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
29 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
14 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
8 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
28 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
0 votes
0 answers
29 views

Check For get_post_meta on Author Archive Page

I've had a good look thru the Similar Questions for an answer and i'm looking to check if a value for a custom field key on single posts has been added using get_post_meta(); however i want to use ...
user avatar
  • 447
0 votes
1 answer
51 views

Is duplicate `_wp_attachment_image_alt` meta key allowed?

This line in my plugin: $wpdb->query("ALTER TABLE {$wpdb->prefix}postmeta ADD CONSTRAINT postmeta UNIQUE (post_id,meta_key(100))"); gives me the following error: [Duplicate entry '539-...
user avatar
  • 63
0 votes
0 answers
7 views

Featured Images most often doesnt appear

I recently facing a problem that never occure before. When i open "add new post" page most of the time "Featured Image" option doesnt appear.However if i keep refreshing the ...
user avatar
0 votes
0 answers
55 views

Filter images from media library by guid meta field

I am using the ajax_query_attachments_args filter attempting to remove certain images from the wordpress media library. They are all in a separate folder within the uploads directory called "...
user avatar
0 votes
0 answers
14 views

Sending all categories associated with a post to Google Ad Manager for use with .setTargeting

I need to pass all categories associated with a post to Google Ad Manager. I'm getting a single category using this code, but if a post has multiple categories I'm just getting the one category passed ...
user avatar
  • 11
0 votes
0 answers
21 views

Count Post and Page Views based on meta_value Using Shortcode in Dashboard Widget

I'm working on a counter that, each time a post is viewed, the meta value is updated by 1. This works fine, but I cannot seem to figure out how to make it count posts and pages, including the home ...
user avatar
0 votes
1 answer
83 views

Which is faster wpdb & get_row or wp_query & ge_post_meta?

Im planning to make a private api and i was wondering which one should i use go for my datas. wpdb & get_row with my custom sql regular wp_query & get_post_meta() Im wondering if it's better ...
user avatar
1 vote
1 answer
231 views

ACF: How to get the full field name (meta_key) by a field key?

In Advanced Custom Fields: Which function can I use to get the full meta key of a field by its field key? So, if I have a field with the name some_field and the field key field_sd54hfs5df: How do I ...
user avatar
0 votes
1 answer
32 views

Order category posts by last word of custom field

I'm trying to order a category page by the last word of a custom field that all of its posts have. The custom field represents a name, so the last word would be the last name. In the end, the posts of ...
user avatar
  • 3
0 votes
1 answer
26 views

Should I use a custom taxonomy or custom post type for grouping a list of panels associated with a group of tests?

I am struggling to word this correctly, but we have a list of laboratory blood tests listed: Comprehensive Blood Panel Basic Blood Panel Liver Blood Panel Cholesterol Panel and many many more These ...
user avatar
0 votes
2 answers
27 views

How to create review point system for CPTs (many-to-many relationship)

I am working on a Wordpress project where I have movies, books and games as custom post types. Any logged in user can add stars(review points) to each of the CPTs. My way of implementing this was ...
user avatar
0 votes
2 answers
34 views

Negative meta_query if storing multiple post_meta values with shared meta_key

WordPress supports storing multiple post meta values for a single post using the same meta key. For example one post can have multiple instances of meta_key 'pet' with meta_value 'cat', 'dog', and/or '...
user avatar
0 votes
0 answers
22 views

How do I list taxonomies that have upcoming events in WP? Is there a way to do this without having to query posts first?

I'd like to create a list of taxonomies that contain forthcoming events. Dates of events saved as a custom field? The technique I am using is to query all posts and extract taxonomies before filtering,...
user avatar
0 votes
0 answers
16 views

I want to Add Feedburner Right After Meta Details

I want to add the Feedburner icon right after the meta details in all single posts. How can I do this? I am using the GeneratePress theme. Please help. here is the Example: https://www.hobo-web.co.uk/...
user avatar
0 votes
0 answers
9 views

Post meta not working

I'm trying to set custom category and post meta but I think they are somehow blocking eachother. $post_tarjousid = wp_insert_post($post_tarjous); $category_id = 22; $taxonomy = ...
user avatar
  • 1
0 votes
1 answer
33 views

How to save EXIF metadata in WordPress database?

I have a function that gets retrieves image EXIF metadata and displays it on attachment edit page. function wp_read_image_metadata_exif( $file ) { if ( ! file_exists( $file ) ) { return false; } ...
user avatar
  • 1
1 vote
0 answers
28 views

Wordpress Rest API to call page data associate with custom meta

I have an ajax rest api called to retrieve certain page data, the call was success but it's come with blank meta, is there any workaround to call api associated with meta data along? var request = ...
user avatar
  • 11
0 votes
0 answers
24 views

Help to Create a Simple Plugin to make a post

im new on wordpress development,for study purposes I need some help to create this simple plugin: one text box one button Explanation: I insert a value inside a text box. I click on the button and ...
user avatar
  • 11

1
2 3 4 5
39