Questions tagged [meta-value]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
23 views

Best Practice for storing aggregate data by date or other criteria?

I'm creating summary descriptions by year. To do this I do update_post_meta on save to set values for word count, image count, external link count. So for a year archive page I iterate over each post ...
artlung's user avatar
  • 3,087
0 votes
1 answer
24 views

Get meta value based on user id

I need to get the meta value based on user id. Such as, I have meta_key called event_comments and the meta_value for this will be set to either Yes or No. I need to get that for the current user id. ...
Darth Mikey D's user avatar
0 votes
1 answer
69 views

Can I count every article following extracted meta value?

I can show all value in certain meta key(species1 and species2) by my code below. It shows like this. $species[]contains many kinds of bird species. Crow Eagle Crane Pigeon... Now, I like to count ...
cwhiro's user avatar
  • 25
0 votes
0 answers
20 views

SQL query based on two different custom field values

I have custom post type "store" that has two different custom fields: Coutry and City. When in the single country page I list all the stores in that country. What I would like to do is to ...
chaq's user avatar
  • 1
0 votes
1 answer
66 views

Update post meta array - add new, single value

What i'm trying to do - i have meta field in post with array of user emails, i'd like to add new user email(if it's not there already) with each submission of Contact form 7. Here's what i managed to ...
Nikson's user avatar
  • 15
2 votes
1 answer
197 views

Block Editor - Meta values not saved, meta changes to empty array on update

Issue TL;DR I have a block that updates meta values, but when I click 'update', the values are not saved for the post. Additionally, the meta values I get from useEntityProp load as an object with ...
Baerkins's user avatar
  • 163
0 votes
0 answers
23 views

How to find the source of a rendered string?

I truly appreciate it if you could help me with this issue since I could not fix it for the last few days. I am currently using a journal publication plugin and when a new paper is submitted by the ...
Cogito's user avatar
  • 1
1 vote
1 answer
46 views

How to `'orderby' => 'meta_value_num'` in a series of orderby parameters

I'm running a site for a book store. Each book has a catalogue number. These numbers are often a string with numbers in it. For example- PUB 1 would be a common entry, as well as PUB 12. Right now, it'...
DJZEEGLER's user avatar
  • 119
0 votes
0 answers
15 views

printing taxonomy and meta fields values

I have the following code in order to print the post ID in a certain point of the archive page. In the same line I'd like to print other meta data, better to say an icon and than the corrispondent ...
Andrea Sacconi's user avatar
0 votes
1 answer
160 views

get Custom field label (select/dropdown) on front end

I have custom field added to product posts. This is dropdown field and displaying on front end it pulls the option value which is not display friendly, for example select option value is "...
Damir Gasparlin's user avatar
1 vote
0 answers
107 views

Saving multiple custom meta box fields

So, I have a custom metabox, with multiple fields on it, and the amount of boxes is variable (could be 3, could be a lot more, depending on order quantity number) I'm trying to write a save function ...
Mark Tabner's user avatar
1 vote
1 answer
170 views

Query a meta key using an array of values where the database value is a string

If a meta value in the WordPress user_meta table is set as a comma separated list and not a serialized array, how can we compare an array of possible values to the values in the database table? ...
armadadrive's user avatar
0 votes
1 answer
227 views

How to save mediaupload multiple URLs as array meta?

I want to add multiple images to meta. I am able to save single url successfully. I am not sure how to add multiple URLs to meta. The single image mediaupload works fine. below is the code for it. The ...
Mangesh Yadav's user avatar
1 vote
1 answer
34 views

Wordpress show content if current user get spesific role and spesific meta value

How to make conditional if statement like "Show content if current user get spesific role and spesific meta value", if not.. hide content <?php if( ( current user get spesific role and ...
Tuagapat Manam's user avatar
0 votes
2 answers
76 views

How do I empty a specific meta_value for all users in PHP

I've been able to successfully empty the meta_value for a specific meta_key. The problem is that a new meta_key will be created for all users in the database. I do not want all users to have the ...
Rob's user avatar
  • 15
0 votes
0 answers
40 views

Meta_query with key as an array

I facing a problem with a meta_query where the meta_key's value can have multiple dates : My meta field event_dates can have several dates like : 20220902,20220928 CODE EXPECTED : $today = date( "...
nico's user avatar
  • 25
0 votes
1 answer
161 views

Multipe array in meta_input

I want to insert post with wp_insert_post and add meta_input in it. I have to send my data with array but I have problem to send more than one Here is my code : wp_insert_post( array( ...
Mehran Pourjenabi's user avatar
2 votes
2 answers
1k 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 ...
ebell's user avatar
  • 53
0 votes
1 answer
36 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 ...
Jawequo's user avatar
1 vote
1 answer
22 views

Why isn't my `meta_query` array functioning properly?

I am trying to include a meta_query to only show the 'post_type' => 'want-to-sell-post' that have the key 'key' => '_wpcf_belongs_artist_id',. Right now, all want-to-sell-posts are being ...
DJZEEGLER's user avatar
  • 119
1 vote
1 answer
32 views

Better way to list links with different meta values using same meta key?

This works, but I will need it to make 8 different lists on the page, using same meta key but 8 different meta values. Is there a more efficient way to achieve this rather than repeating the same code ...
KSechrist's user avatar
0 votes
1 answer
106 views

How to get comment images stored as serialized comment meta

I want to display images under for each comment but images store in database as serialized a:3:{i:0;i:775;i:1;i:776;i:2;i:777;} I wrote this code print_r (get_comment_meta( $comment->comment_ID , '...
Teymur Abbasov's user avatar
0 votes
0 answers
708 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 ...
Morty_Smith's user avatar
1 vote
0 answers
103 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'...
nathanziarek's user avatar
1 vote
0 answers
87 views

How to redirect on login to a specific page if a specific meta user is empty

I would like to indicate that if you do not have the first_name filled in when logging in, you will be redirected to a specific page, for example /onboarding and if the first_name field is filled, you ...
FernandoTWE's user avatar
0 votes
0 answers
112 views

Fetch custom post related to a User

I am trying to fetch custom post related to a User. I am using below code. $args = array( 'post_type' => 'tasks', 'meta_query' => array( 'relation' ...
Foysal's user avatar
  • 449
0 votes
1 answer
1k views

User query - getting values for custom meta keys/fields

I am beginner at customizing wordpress but have some experience in PHP coding. I'm struggling to figure out how to display all existing meta keys (custom fields defined by ACF) for all users that have ...
Vesna Mačković's user avatar
0 votes
1 answer
49 views

Order by two meta values - one is a number and the other is text

Based on multiple searches, this is the code I'm trying to sort by two different meta key values. 'meta_query' => array( 'relation' => 'AND', 'listing_order' => array( ...
Brett's user avatar
  • 187
0 votes
1 answer
189 views

How do I echo all users' display_name and their meta_value who have a certain meta_key?

I have a meta_key inside the table usermeta called 'sms_subscriber'. The meta_value for it is their phone number. I want to echo a list of all users who have that field; in other words, a list of each ...
Ben Blue's user avatar
  • 117
0 votes
2 answers
98 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 '...
John Ryan's user avatar
0 votes
1 answer
57 views

get posts based on non-single metadata

I have meta data to custom post "event", registered as non-single, i.e., there is an array od metadata "terms" (it is not WordPress term, I just call it term, it is a record ...
Lovor's user avatar
  • 901
0 votes
1 answer
57 views

I have 3 types of prices in WP and I need to change price for each specific user role using hooks

not a tough coder so could use some help here. What I'm trying to do is, I have 3 types of prices in WP and I need to change price for each specific user role using hooks https://itgalaxy.company/%D0%...
itdoc itdoc's user avatar
0 votes
0 answers
279 views

WP_Query - sort the results by meta value custom attribute wocoomerce

I’m trying to sort products by attribute value. The attribute value is alphanumeric I started from this code Trying with the following code add_filter('woocommerce_get_catalog_ordering_args', '...
Frank's user avatar
  • 1
0 votes
0 answers
176 views

Order (by ASC) posts with meta_key so posts without values are last

I am trying to figure out sorting posts with prices in one meta query, so the posts without prices are shown last, when ordered by ASC and not first. Right now I am temporarily not showing posts ...
Mastafu's user avatar
  • 45
0 votes
1 answer
101 views

why after saving meta value it's saving all the values the one that i clicked?

I have a code that save meta post and show them to the visitors: <?php if(is_singular( 'manga' ) ){ $manga_link=get_post_meta($post->ID,"featured_fields_manga",...
saeed's user avatar
  • 15
0 votes
1 answer
274 views

how can i update my postmeta without losing old data?

I have a code that stores old and new meta_value in the same meta_key but i don't know if it's right or wrong (note that i want to store data in the same meta_key not separate meta_key): <?php ...
saeed's user avatar
  • 15
0 votes
1 answer
188 views

Best Practice? - Saving multiple Values as Serialized Data / Saving each Value per Row / Dedicated Table

For each user the following is to be saved: user_id tag / tag_id (eg. 1,2,3,4,...) timestamp first_seen (for each tag) timestamp last_seen (for each tag) Options which come to my mind: One Row ...
Elv1s's user avatar
  • 3
0 votes
1 answer
95 views

How to update and save user metadata on page visits?

Basically I'm looking for something like this: <?php if ( is_page( array( 'home' ) ) ): ?> update_user_meta( $user_id, 'pagehome', '1' ); <?php else: ?> ...
robert0's user avatar
  • 203
0 votes
1 answer
649 views

if get_post_meta function returns empty - Do Not Display HTML

I am working on a website with some custom PHP. The post uses "Custom Fields", where the custom field "pdf_name" is added to the post when there is a PDF document to attach to it. ...
mark2090's user avatar
0 votes
1 answer
2k views

Sort products by Sale price and stock status

I want to sort products by sale price and in stock and regular price at first but doesn't find solution anywhere. Here is what I have implemented and didn't get the solution: add_filter( '...
vahid sabet's user avatar
0 votes
0 answers
61 views

Query to show post current day

I turn to you since I tried by my means but I could not achieve it It turns out that I have the need to create an rss file to use it in external applications, I have a type of post (events) which ...
user117732's user avatar
1 vote
1 answer
202 views

WP_POSTMETA - What do these values mean inside the data structure?

In the wp_postmeta table, I am seeing data in a field called "meta_value". The structure of the data is confusing. I am trying to understand what these values mean: The meta_key field ...
user1669296's user avatar
0 votes
1 answer
383 views

How to use multiple Meta Field from CPT as Post permalink

i have created a custom post type using Jetengine called "cars" and meta field like this "model" "maker" "year" .. etc, what i want is to use more than one meta ...
Spix's user avatar
  • 13
0 votes
1 answer
714 views

WP Query Meta Value - How To Identify Specific, Unique Values?

On my Club Profile pages, I'm displaying a list of posts (Player Profiles) where the title of the specific Club Profile page is also a meta value contained in those Player Profiles against one or two ...
Pete Hayman's user avatar
0 votes
0 answers
732 views

Meta Query | Compare category name and meta value

I like to create meta query that has a condition like this. Using comparison of meta value, and omitting articles which belongs to category that is same name of meta value. Each article belongs to ...
cwhiro's user avatar
  • 25
0 votes
1 answer
127 views

get_user_meta value is stored within strange characters

I'm trying to access an ID stored within a user profile using the add_user_meta and the get_user_meta function to return the ID, but when I print the values out I am given this strange value. I can ...
Kaleshe Alleyne-Vassel's user avatar
4 votes
1 answer
7k views

How to get all term meta for a taxonomy - getting term_meta for taxonomy

TL;DR: I'm trying to get the meta_value display_type for a taxonomy, but it returns blank (even though I can see it in the database). This question wants to access a term meta that is on a the ...
Zeth's user avatar
  • 858
0 votes
1 answer
128 views

Save queried result into database

in multi author website when author publish post , he/her can give star rating to his/her own post. and I can display average rating for every taxonomy term using this formula: AVERAGE RATING=TOTAL ...
Teymur Abbasov's user avatar
1 vote
0 answers
153 views

How to change File URL in file uploaded to s3 compatible storage with self written plugin [closed]

I'm trying to write a plugin that uploads files directly to an S3 storage and allows to downloads them like files directly on the server. The main page of the plugin contains the following code for ...
Benjamin's user avatar
1 vote
0 answers
64 views

How to orderby multiple meta fields if some fields are empty

I'm trying to orderby meta fields value, but sometimes those values are empty : A > title = 'The apartment', wpcf-f-french-operating-title = ' ', wpcf-f-order-title = 'Apartment' B > title = '...
Wilhem's user avatar
  • 11

1
2 3 4 5