Questions tagged [meta-value]
The meta-value tag has no usage guidance.
221
questions
0
votes
1
answer
68
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 ...
0
votes
0
answers
13
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 ...
0
votes
1
answer
35
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 ...
2
votes
1
answer
53
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 ...
0
votes
0
answers
18
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 ...
1
vote
1
answer
22
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'...
0
votes
0
answers
13
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 ...
0
votes
1
answer
105
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 "...
1
vote
0
answers
97
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 ...
1
vote
1
answer
113
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?
...
0
votes
1
answer
184
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 ...
1
vote
1
answer
32
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 ...
0
votes
2
answers
55
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 ...
0
votes
0
answers
35
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( "...
0
votes
1
answer
114
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(
...
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 ...
0
votes
1
answer
31
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 ...
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 ...
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 ...
0
votes
1
answer
97
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 , '...
0
votes
0
answers
602
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 ...
1
vote
0
answers
81
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'...
1
vote
0
answers
76
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 ...
0
votes
0
answers
107
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' ...
0
votes
1
answer
943
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 ...
0
votes
1
answer
48
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(
...
0
votes
1
answer
159
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 ...
0
votes
2
answers
93
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 '...
0
votes
1
answer
53
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 ...
0
votes
1
answer
50
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%...
0
votes
0
answers
239
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', '...
0
votes
0
answers
161
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 ...
0
votes
1
answer
95
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",...
0
votes
1
answer
257
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
...
0
votes
1
answer
176
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 ...
0
votes
1
answer
56
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: ?>
...
0
votes
1
answer
609
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. ...
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( '...
0
votes
0
answers
53
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 ...
1
vote
1
answer
189
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 ...
0
votes
1
answer
288
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 ...
0
votes
1
answer
651
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 ...
0
votes
0
answers
643
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 ...
0
votes
1
answer
109
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 ...
4
votes
1
answer
6k
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 ...
0
votes
1
answer
119
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 ...
1
vote
0
answers
138
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 ...
1
vote
0
answers
60
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 = '...
1
vote
0
answers
246
views
How to filter meta_values using REST API
i am able to get the data by make an API called with these args ?meta_key=frequent&meta_value=day
are there any possible way to filter with multiple meta_value? i already tried meta_value=day,week ...
0
votes
2
answers
95
views
How to use get_terms() returning only the terms that have posts with a certain custom field value
I use get_terms() to build filter buttons to enable filtering a list of events (custom post_type).
$terms = get_terms( 'kategorien', ['orderby' => 'slug', 'hide_empty' => 1 ]);
Now we want to ...