Reset the variables right before the end of the loop by inserting statements like $company_name="";
. Since there’s no check to make sure the variable becomes empty if the post_meta is empty, it will keep the previous one stored in the variable.
Related Posts:
- WP_Query on custom post type not displaying, multiple loops & get_template_part
- Using new WP_Query in shortcode in a custom field causes the main post content to not display
- WP Query group/order by category name
- wp_query to find posts by year and month
- WP_Query orderby modified to include custom meta changes
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- Orderby CPT custom fields not working
- Having Issue on Ordering CPT by Custom Field In Custom WP Query
- How do I list a custom field and custom taxonomies for each result in a loop?
- Custom meta fields not showing up in WP_Response Object via custom endpoint
- sorting in wp query based on custom field value
- WordPress query in which condition uses custom field
- WordPress loop add heading before first of type
- How to make a shortcode for my WP_Query Loop? [duplicate]
- How to have the right design for a custom post type without accessing themes
- Unable to get post content from custom post type loop
- Lists Posts from CPT that match the Title of the Page
- handling csv data with a custom post type
- Help Structuring Query for Archive Pages
- Conditional to modify query results
- Customize permalink when creating a post
- Loop on front-page.php
- Filtering by Post Meta Custom Fields – Performance
- WP Query—Relationship between two custom post types and their fields
- Create a random unique 6 digit number as custom field for custom post type
- How to dynamically attach pictures to a carousel
- Remove duplicated values from a loop
- Custom Post Type Navigation on Custom Field
- Custom Post Type Loop within Shortcode
- How to insert content from another Custom Post type into Post?
- Get all Posts If has same custom field values in Posts
- WP_Query | ‘post_type’ doesn’t work
- How to connect two custom post types with nested loops
- Filter by custom taxonomy slug on a custom post type
- Custom Post type and Custom Field WP_Query
- Query custom post type in the loop
- Loop through Custom Post Type, and then show children within each iteration
- Including Custom Meta with posts_where query
- how do i remove posts from a WP_Query so the pagination is right?
- Very Slow Page – How to Optimize # of Queries?
- Can I create a loop with multiple post types and specify different $args for each post type?
- Display CPT posts based on specific taxonomy
- WP_Query: include custom post type only with specific meta value
- WordPress custom loop filter by meta_key and value with serialize data
- Returning a list of custom post types excluding those without a specific meta_value
- How to make sure content doesn’t display if selection is empty
- Show one item per category of a custom post type
- Meta Key Value in current-user-only loop
- Calculate all custom field values in the post loop
- wp_query check if integer exists in custom field’s array
- Custom loop with multiple taxonomy queries
- Give a permalink to Custom Post Types without title
- What is the recommended / best way to do this: Event calendar post/type in a block-based theme?
- How can I get the number of custom post type posts that have a specific attachment image set?
- Problem querying Custom post type by custom fields
- WP_Query order by custom field, then randomly order some of results
- Query custom post type with ACF Date
- Store CPT ‘Reviews’ average ratings to a WordPress DB table or to a DB custom table?
- Including metaboxes from custom post types in global search — continued
- Query Multiple Custom Posts by Custom Fields
- What’s the WP way to load remaining custom posts?
- Get Posts by multiple custom fields is not working
- WP Query with categories only shows one post and ignores the category
- Order Custom Post Type by Custom Field Value
- How to use TinyMCE Editor for one of my custom post meta field?
- Problem: wp_query outputs all images on site
- How to Create a WordPress Plugin With Custom Post Type/Custom Field Features?
- First custom field value (out of several) displayed twice after query
- Possible to filter custom post type with multiple meta data?
- custom comments form for custom post type
- pagination not working for category.php (custom post types in categories)
- Query based on custom fields start and end date
- Custom fields for custom post type
- Redirect to another page using contact form 7? [closed]
- Wrapping x posts in html without leaving empty html
- WP Query post__in not returning correct results
- Sort posts in loop by the WooCommerce Membership of the author
- DIsplaying URL of custom field in last post of certain taxonomy && post type
- Custom post type’s extra fields – how to handle?
- Send a conditional email notification when a custom field value changes in Post Type
- How can I group posts by months and years?
- Multiple Custom Post Type queries, how to DRY it up
- Custon Content within WordPress Loop
- Main query not querying any posts in custom taxonomy template
- Loop increase number
- WP Query ‘posts_per_page’
- Using wp_query to modify the loop in index.php for a CPT
- ACF in wordpress
- Display post from a date range from custom field
- Custom WP_Query doesn’t display all posts
- Query & the_content() is showing in the header
- post_per_page ignored in WP_Query
- How to get specific post meta by title or id
- get_pagination not working on a custom post type query (using WP_Query)
- WP_Query with custom post type ID
- Getting a custom post’s custom field based on another custom post’s custom field select
- How to conditionally add Custom Post Type to Front Page
- Dynamically insert code to custom post type loop
- hide specific div on single.php [closed]
- WP_Query orderby not work with meta_key