Skip to content

Magenaut

  • Home
  • Topics
    • Notes
    • Tutorial
    • Bug fixing
    • Extension
    • Server
  • Q&A
  • Privacy Policy
  • About

meta-query

meta_query for a string inside a meta field containing a comma-separated list

August 6, 2022 by Magenaut

In my project the WP users have a custom meta field “usergroup” containing a comma separated list of values. The meta field can contain values like this:

Categories Q&A, Wordpress Tags custom-field, meta-query, user-meta Leave a comment

Search filter between promo and exact price

August 6, 2022 by Magenaut

I’ve got lots of posts with promotional prices and the rest have an exact price. I just wanted to make sure that if promotional price exists, use the promotional price as the target data when I try to submit a value from the input range else use the real price.

Categories Q&A, Wordpress Tags meta-query, wp-query Leave a comment

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

August 6, 2022 by Magenaut

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 keys: Previous or Later.

Categories Q&A, Wordpress Tags meta-query, meta-value, wp-query Leave a comment

Avoiding ACF get_field and returning to core WordPress function

August 5, 2022 by Magenaut

function slb_subscriber_column_data( $column, $post_id ) { // setup our return text $output = ''; switch( $column ) { case 'title': // get the custom name data $fname = get_field('slb_first_name', $post_id ); $lname = get_field('slb_last_name', $post_id ); $output .= $fname .' '. $lname; break; case 'email': // get the custom email data $email = get_field('slb_email', $post_id … Read more

Categories Q&A, Wordpress Tags core, custom-field, meta-query, post-meta Leave a comment

How to check if a post meta key/value pair already exists for a specific post

August 5, 2022 by Magenaut

I want to know if for a given post ID $post_id, there is a metadata key and value pair stored that matches a given key $meta_key and value $meta_value pair.

Categories Q&A, Wordpress Tags meta-query, post-meta Leave a comment

Make meta query treat meta_value as 1 or 0

August 5, 2022 by Magenaut

My products have no in-stock status, just a quantity in stock. Is there any way to make meta query to treat its value as 0 or 1? Like, first the values that are not 0, then that are 0.

Categories Q&A, Wordpress Tags meta-query, wp-query Leave a comment

If two first numbers exist in wp_meta_query value

August 5, 2022 by Magenaut

I want to display a Custom post Type “Companies” filtered by zipcode.

Categories Q&A, Wordpress Tags advanced-custom-fields, meta-query, wp-query Leave a comment

How to improve my non-unique metadata MySQL entries?

August 5, 2022 by Magenaut

I’m working on a plugin for WooCommerce which uses a cpt called Restock. In a Restock post you can enter products ( id ) plus restock. The user can add as many product restock pairs as they want per post.

Categories Q&A, Wordpress Tags custom-field, meta-query, metabox, mysql, post-meta Leave a comment

List all categories and count number of posts within based on custom date

August 5, 2022 by Magenaut

I used this solution to count number of posts for each category (list).
The counting is based on date post event (only from today’s date).

Categories Q&A, Wordpress Tags categories, count, meta-query Leave a comment

Selecting posts with a given meta value for a meta key

August 5, 2022 by Magenaut

I’m trying to run a query that returns all the posts with a given value for a specific meta key. I know for a fact that this is none of the posts on my test server but it reports finding all the posts with a post count of 7 (there are 21 posts).

Categories Q&A, Wordpress Tags meta-query, wp-query Leave a comment
Older posts
Page1 Page2 … Page4 Next →
  1. michealSmith07 on Is there a way to dynamically refresh the less command?August 21, 2022

    That is a very nice post. I like this post.

  2. anonymous on Fix libwacom9 dependency issue when upgrade DebianJune 27, 2022

    saved my day!! Thanks for the help…

  3. sreedhar on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    Thanks its working

  4. saintnick on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    remove libwacom2 worked for me as well

  5. ranafoul on Fix libwacom9 dependency issue when upgrade DebianApril 22, 2022

    apt remove libwacom2 helped on kali 2022.01. gr8

.net ajax asp.net asp.net-core asp.net-mvc asp.net-mvc-3 asp.net-mvc-4 asp.net-web-api bash c# command-line css custom-post-types custom-taxonomy dataframe dictionary django entity-framework functions gridview html iis javascript jquery json linux list matplotlib numpy pandas php plugin-development plugins posts python python-2.7 python-3.x security shell shell-script sql string vb.net webforms wp-query

© 2026 Magenaut • Built with GeneratePress