Questions tagged [meta-value]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
10 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 ...
user avatar
1 vote
1 answer
23 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 ...
user avatar
0 votes
1 answer
38 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 , '...
user avatar
0 votes
0 answers
32 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
0 answers
15 views

Making WP_Query limit results by date before today where date is a meta_query

We have a custom post type, events. This has a custom field called event_start. In trying to query only past events, I'd like to limit the query with this basic logic: post type is events event_start ...
user avatar
0 votes
0 answers
40 views

Orderby meta_key/meta_value not displaying anything, am I overlooking anything?

I have an issue with my orderby using get_posts(). I want to order in alphabetical order a list by city name using a custom meta field, but it comes back empty. However when I orderby title, the list ...
user avatar
0 votes
0 answers
23 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
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
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
1 vote
0 answers
31 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 ...
user avatar
0 votes
0 answers
31 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' ...
user avatar
  • 377
0 votes
0 answers
20 views

How to Ordering by user meta

I am learning WordPress meta query. I am trying to fetch users with asc order of last_name & first_name. My code is like below. if($_POST['orga_id']) { $users_query = array( '...
user avatar
  • 377
0 votes
1 answer
38 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 ...
user avatar
0 votes
1 answer
43 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( ...
user avatar
  • 187
0 votes
0 answers
22 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
42 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 ...
user avatar
  • 107
0 votes
2 answers
35 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
1 answer
50 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 ...
user avatar
  • 416
0 votes
1 answer
20 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%...
user avatar
0 votes
0 answers
16 views

Show metadata in users.php - wordpress

is there any way to show metadata in the list of all registered users "users.php"
user avatar
  • 3
0 votes
0 answers
22 views

How to use custom slug and custom templates for custom taxonomy?

I haven't used taxonomies much, so not sure what the correct way to do this is. I have a custom taxonomy called collections. I want an archive page for this that shows all the collections. I can ...
user avatar
0 votes
0 answers
69 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', '...
user avatar
  • 1
0 votes
0 answers
82 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 ...
user avatar
  • 45
0 votes
0 answers
39 views

Set all WooCommerce Products to Simple, Virtual & Downloadable

I want so set my all products of my WooCommerce store to Simple -> Virtual and Downloadable Programmitacly. And hide all the Unwanted tabs & fields like shipping, Inventory, etc.
user avatar
  • 78
0 votes
1 answer
42 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",...
user avatar
  • 15
0 votes
1 answer
69 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 ...
user avatar
  • 15
0 votes
1 answer
75 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 ...
user avatar
  • 3
0 votes
1 answer
44 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: ?> ...
user avatar
  • 203
0 votes
1 answer
184 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. ...
user avatar
0 votes
1 answer
540 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( '...
user avatar
0 votes
0 answers
33 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 ...
user avatar
1 vote
1 answer
57 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 ...
user avatar
0 votes
1 answer
126 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 ...
user avatar
  • 13
0 votes
1 answer
98 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 ...
user avatar
0 votes
0 answers
156 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 ...
user avatar
  • 21
0 votes
1 answer
50 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 ...
user avatar
4 votes
1 answer
2k 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 ...
user avatar
  • 608
0 votes
1 answer
21 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 ...
user avatar
1 vote
0 answers
36 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 ...
user avatar
1 vote
0 answers
42 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 = '...
user avatar
  • 11
1 vote
0 answers
35 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 ...
user avatar
0 votes
2 answers
30 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 ...
user avatar
  • 109
0 votes
1 answer
16 views

Set class if a meta value is set within post archive

I'm attempting to add a class to posts when the meta key 'checkbox' is clicked. Here's what I have: <?PHP $checkbox = get_post_meta($post->ID, 'checkbox', true); if (!empty($checkbox)){ $...
user avatar
0 votes
0 answers
37 views

Querying terms with calculations based on term meta data, sql vs. get_terms

Is it viable and or advisable to try and implement a query like the below through get_terms and its meta query functionality? Basically, I query terms of a specific taxonomy 'pr' that have meta fields ...
user avatar
1 vote
0 answers
21 views

How do I set default meta value by post type?

I'm trying to set a meta variable depending on what custom post type is set but can't get my code to work. This is the function in the plugin that sets the metabox after the plugin has added it to ...
user avatar
1 vote
1 answer
159 views

How to break meta values into different items and avoid duplicates?

I'm trying to build a filter for a custom post type page. The custom post type has a metabox that allows inputting of different authors. I am displaying the post names in a dropdown like this, using ...
user avatar
0 votes
1 answer
36 views

Query custom post type custom meta key

I want to get all post with the value X looking in the meta_key field. After tha I want to loop trough all post and get the title. I got this so far. function get_events( ) { $recurrence_ids = ...
user avatar
0 votes
1 answer
55 views

WP_Query multiple value not working

How to query for multiple meta key values with the same key i have this query but multiple value not working for me, Where is my code wrong? if( isset( $_POST['scheduled_scan'] ) && $_POST['...
user avatar
0 votes
0 answers
32 views

When I add metadata, metavalue length is added in to the value in some cases

When I use the following code: update_post_meta($new_post_id, '_test_metakey1', 'a:1:1;'); update_post_meta($new_post_id, '_test_metakey2', 'a:1;'); The database adds the keys as follows: Why does ...
user avatar
0 votes
0 answers
231 views

Query posts by current ACF meta key value on single page as related posts

I would like to Query a custom post by the current ACF Meta Key values on a single custom post type page. I currently have a CPT called "news", a single-news.php page and ACF checkbox ...
user avatar

1
2 3 4 5