You don’t have a meta_value in your query.
From your code I can’t tell what you’re doing with the meta values but you should be able to do this:
// Store this BEFORE you go into the second loop.
$category = get_field('category');
// The arguments for the second loop
'post_type' => 'case-studies',
'showposts' => 3,
'meta_key' => 'category',
'meta_value' => $category,
'orderby' => 'rand'
So what you’re doing there is matching the value of the category meta key.
Ideally you would be using a taxonomy to do the above – that’s what they are there for.
http://codex.wordpress.org/Function_Reference/register_taxonomy
Related Posts:
- how do i remove posts from a WP_Query so the pagination is right?
- Redirect to another page using contact form 7? [closed]
- Price comparison table based on Custom Post Type?
- WordPress hide post from custom post-type on a single page
- Manually set global $post vars with an ID, in order to use template tags
- Is it possible to define a template for a custom post type within a plugin independent of the active theme?
- How Do I Use The WordPress Plugin Posts 2 Posts by Scribu?
- Template for custom post type shows all posts instead of just one
- Fastest way to loop through all posts?
- Enable comments for post with comments meta box removed
- Custom Post Type causes Page Not Found
- post expire after x days
- add_meta_box Callback not being called
- Plugin allowing for artists, events and venues
- Is there a way to order posts and custom post types as one group?
- Saving Custom Post types and fields to a custom table
- Accessing post’s meta data based on user’s click of a post
- get_post_type on post.php
- Matching Chapters to a Custom posts [closed]
- Creating a custom post type, adding custom meta fields, preventing all future editability of posts of this type
- auto populate list of questions if user select a category xyz
- Custom Post Type Fields
- How to delete all trashed item in one-go
- Custom setup of wordpress comments that are displayed
- Recent posts per category loop?
- Import Instagram post to WordPress blog post
- How to Resize the Custom Post Images?
- Amazon.com intergration with WordPress?
- Sticky option for custom post types without using custom fields or plugins
- posts from multiple post types in one slider
- How do we update a custom file upload field with the Advanced Custom Field plugin?
- Modify Posts from Custom_Post_Type within the plugin
- How can I store data from custom fields to custom tables?
- Custom Template for wordpress cpt plugin
- What hook can I use to modify custom post data before it is displayed on the page?
- Plugin is creating posts twice
- “After file loaded” action
- Dictionary-style definition list plugin
- How to create repeater field manually, without plugin (ACF Pro)?
- What snippet do I need to type to show my ACF field show up on my theme?
- Is there a way to make [Table Of Content] plugin while not using revision data?
- Is it possible to pin a post in second position from top
- Register PODS Custom Field with WPGraphQL [closed]
- Is there a hook similar to “save_post” which only fires AFTER the post is completely published?
- Adding custom post category to categories widget
- How to display the custom post related blog by category?
- Create multiple posts when a custom post is created
- Is it possible to customize a wordpress post from outside dashboard(Something like site.com/post-type/post/?e=post_id)?
- How to Save settings of custom tab product page in admin side in a database?
- Add new post using a page inside the website
- Displaying image from a repeatable group
- WordPress list child pages of custom post type
- What method should I use for a sidebar widget that reads latest posts?
- Synch Custom Post Types (and Custom Fields, Cats, etc.) Between WordPress Sites
- Insert data in custom table during new post creation
- single.php fires more than once after clicking on any post to view with different post id each time
- How can i do custom author list?
- A plugin for software reviews site like this one?
- Outputting custom field query from a plugin to the website header
- Links not opening as they should. Custom WP plugin
- Is there a plugin or another way that can help me find out the underlying files of a page/post? [closed]
- How to export post tags from wordpress
- How to create a Page alias in WordPress
- How to filter content post only on save
- Is there plugin to show recent posts from one website in the widget area of another?
- FacetWP group listings by custom field [closed]
- Meta Key Value in current-user-only loop
- Override global query results without hooks
- submit posts by unregistered users in wordpress
- Update Post Meta for a logged in user
- Two problems on my WordPress installation [closed]
- How to pull email and name from Flamingo plugin
- Which widget to use for display category post with view more? [closed]
- Unable to delete custom post types, confusion around capabilities
- Execute js files doesn’t seem to work
- How can I use a file in my plugin as a replacement for single.php on custom-post-type query?
- How to set category correctly for a custom post created by a remote API call?
- Moving FB comments at the end of page
- WordPress function to add text warning on every pages [closed]
- I would like to remove date display on photo preview
- If/Else child list for Custom Post Type single template within loop?
- Rename existing cpt and taxonomy with new textdomain
- Create a pdf from the entries in DB
- What database state changes happen after a post is manually “updated” with no changes?
- save_post hook partly firing in update post
- custom fields not displaying on wordpress site
- Show post object of any page in frontend
- Can’t add new plugin or themes on a wordpress multisite network from the primary site as administrator. Error: ERR_TOO_MANY_REDIRECTS
- Trying to add a new feature in my wordpress website
- Prefix WordPress Taxonomy Tags With Hashtag Symbol Like Twitter
- How to display all custom fields associated with a post type – IN THE ADMIN AREA?
- Top Contributors Plugin with Custom Post Type
- How to hide home title on pages and posts?
- Windows 10 Printer that Sends to WordPress [closed]
- How to display content depending on the Woocommerce Product Category
- How to customized post slider layout in elementor wordpress [closed]
- Show WooCommerce products based on query parameters on redirect
- How to access the page without registering in wordpress
- CPT template is not being automatically used single post pages
- Create CPT on Ajax Call