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
- What is the easiest way to create a custom field archive?
- how to compare date meta value in jet smart filter Date query?
- How to check if the post exists in any of the categories?
- Redesigning Custom Post Type “Add New” page
- Getting Custom Post Type content from main-site of a Multisite
- Publish Post After Click On A Link
- Is there an action that is called when a post is restored from the trash?
- Replace existing pages with new pages, keep menu links
- How to use custom fields to enable sticky posts on custom post types?
- New post notification plugin [closed]
- How to insert content from another Custom Post type into Post?
- How I can get custom field’s current value?
- Woocommerce – How to populate custom select field with stored values on checkout page?
- Use wordpress functions in another PHP file
- how to add a button next to the wordpress view button?
- Get User_id outside wordpress,
- Article content navigator in wordpress like mbaskool website
- get current page number with wp_link_pages()
- Delete data from custom table when deleting a post
- WP Insert Post If user refreshes override new post
- Summary and Comments on Main landing Page
- A sports wordpress website
- Method/Plugin/Hack to Start a Post with an Writing Outline?
- Only the most recent post is showing on my category page (working on localhost, not live site)
- Oops! That page can’t be found
- Custom plugin issue – Notice: Trying to get property of non-object in
- How can I group by Taxonomy on Custom Post Type while filtering out based on custom Meta
- subtracting the current post form then whole loop, which is generating all CPT titles
- How to wrap image tag into div for post only?
- Problem with conditional woocommerce custom checkout field
- Need help getting a certain value out of a multi dimensional array
- If i have custom post type with 5 custom fields do i have to create a new loop to reference each one?
- Styling first post using Advanced Custom Fields
- How to list the categories by custom taxonomy created?
- How to block external download link access if visitor not referred from WP?
- Notifications Bar on home page only
- Distribute post content through several divs [closed]
- Does anyone have the Custom Post Permalinks plugin from John P. Bloch? [closed]