<?php
$cat = get_post_meta( get_the_ID(), 'cat_page', true );
$args = array(
'category_name' => $cat,
'meta_key' => 'niveau_chiffre',
'orderby' => 'meta_value_num', //Since we're dealing with numbers
'order' => 'ASC',
//'meta_query' => array(
// array(
//'key' => 'niveau-chiffre',
//'value' => 'niveau-chiffre', Don't give a value because we're not looking for a specific one
//'compare' => '>=', We're not comparing as such. Defaults to =
//'type' => 'NUMERIC'
//)
), //You missed a comma here I think
);
Try this.
Related Posts:
- Orderby meta_value only returns posts that have existing meta_key
- Auto sort the wp-admin post list by a meta key
- Limit the number of acf content when displaying in post loop [closed]
- Can I access a post meta field before the loop?
- wordpress custom loop ascending descending posts by custom field
- change order of images attached to post
- Filter or order based on custom field
- Compare ACF date field (if exists) and post date and order DESC
- Get meta value when the page is a blog archive
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- How to get custom post meta using REST API
- The “_encloseme” Meta-Key Conundrum
- Using get_post_meta with new_to_publish
- Can I count the number of users matching a value in a multiple value key?
- Allow user to create instances of custom field
- get_pages sort alphabetically by meta value
- Get updated meta data after save_post hook
- Save HTML formatted data to post meta using add_post_meta()
- How to break meta values into different items and avoid duplicates?
- ajax delete value from custom field array
- Save attachment custom fields on front end
- How can I sort get_users() by any value (last_name, user defined fields and more)
- Transition from (classical) serialized custom meta field to (gutenberg) rest enabled meta
- Unable to show ACF’s Image Custom Field properly in Genesis Framework [closed]
- Custom field value based on other custom field values
- Saving custom image meta fields
- Author Page Custom Query WHERE author OR [post meta value] OR [post meta value]
- How do I exclude posts by custom field value?
- How to display Meta Field Value?
- Create a random unique 6 digit number as custom field for custom post type
- Upcoming Event: How do I sort database by custom date field, but ignore past dates?
- Combine multiple custom field values into single value
- How do I use wp_query for WordPress search?
- Nav Menu – Add class based on meta keys
- Sorting posts ordered by custom field value
- How can I show custom fields in the loop only to specific user roles?
- Can’t get post ID using wp_insert_post_data
- Accessing loop functions (e.g the_title or the_content) from post ID
- Unique Post Meta Values
- How to create a shortcode to print specific values stored in a post meta array?
- Add custom field to all posts in specific post_type
- Is there a better way to list all database terms alphabetically?
- Change the sort order for posts to include custom field
- Button inside Custom Meta Box triggering the Update Button
- How to load an assets based on custom field value?
- List users by sum of all their posts’ custom field values
- Custom WP_Query for WordPress Search Results with meta_query
- Custom Fields – How to create a list from multi-line entries of a single value
- Unique meta_key with array value vs repeated meta_key with single values
- Sort WP_Query with numeric custom field
- Efficiently sort only certain categories by custom field
- Allow only one post with specific meta value
- How to validate select field in post meta?
- How to display childrens custom fields?
- how to display custom fields of post on a web page
- Hide custom fields when empty
- How do I query the title (or handle?) of post meta fieldset (created with Simple Fields Plugin)
- Save all the post tags inside a custom field
- How to fill custom fields with brackets in their key with add_post_meta()?
- How add multiple wp_editor_box to new post
- ul list with only as many li’s as filled custom fields
- Loop through incrementing custom fields
- Get YouTube video id from url in a custom field
- Related query shows same image in loop
- Can’t Output get_post_meta?
- put saved metabox values back into fields and then display on the front end
- How to get custom image field of specific post id
- How to sort by custom field value?
- Custom field outside the loop and inside an array
- get_post_custom_values problem, please help
- wordpress multi user question
- How can I change author of posts to the value of one of the custom field of the posts?
- Custom meta fields and meta keys
- How to improve my non-unique metadata MySQL entries?
- Saving Custom Field that includes Quotation marks
- Custom Fields Not Showing (ACF not installed)
- Post meta data not showing in frontend, until hitting ‘update’ button
- searching by keywords in post’s metas or pagination links problem
- How do I update custom field post meta in frontend post template?
- update meta field value after
- get wordpress post loop by meta box date
- Sort posts by custom fields with empty values
- Custom Fields Not Working In Footer
- ACF plugin and field update
- Query Posts based on custom field value
- Echo out custom fields in comments
- Display Data From This Custom Media Upload Meta Box?
- Sort custom fields in admin by last field added
- Save values generated via API as custom meta fields
- update_post_meta not working in action hook
- Display meta data from a custom field within plugin Category Grid View Gallery
- Hard Define Custom Field Value
- Retrieve IDs from custom field, count and display results differently according to count
- Pagination not displaying correct number of pages
- How do i output images from URL’s added to the same custom field key
- Can’t sort custom column on user.php by number / meta_value_num?
- Custom field not showing
- add multiple values (array) to post meta_input
- save all acf options in one meta_value [closed]
- WP Query Args – search by meta_key or title