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]
- Display all posts in a custom post type, grouped by a custom taxonomy
- Sorting a query by custom field date
- Display several random posts, but make sure a condition is met
- How can I generate a RSS feed based on a custom WP_Query?
- wordpress plugin error handling
- Retrieving 3 latest post from each of 5 different custom post types
- How to sort CPT by custom meta value (date), and return posts month by month
- How to solve suspected memory issue in custom WordPress loop?
- How to create posts (not post template) to be displayed on projects page?
- WP_Query post at custom position
- Comparing timestamps in meta query doesn’t work
- Display two post types ordered by two custom fields
- how to set default value for checkbox in wordpress
- How do I Use Nested Loops of Custom Post Types for MultiSite Blogs using WP_Query()
- Impossible to get Attachments Outside WordPress?
- Help Structuring Query for Archive Pages
- Conditional to modify query results
- Customize permalink when creating a post
- Loop on front-page.php
- Create a random unique 6 digit number as custom field for custom post type
- Custom Post Type Navigation on Custom Field
- Get all Posts If has same custom field values in Posts
- 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
- Very Slow Page – How to Optimize # of Queries?
- How to make sure content doesn’t display if selection is empty
- wp_query check if integer exists in custom field’s array
- How can I get the number of custom post type posts that have a specific attachment image set?
- Query custom post type with ACF Date
- Including metaboxes from custom post types in global search — continued
- WP Query with categories only shows one post and ignores the category
- Order Custom Post Type by Custom Field Value
- Redirect to another page using contact form 7? [closed]
- WP Query post__in not returning correct results
- Sort posts in loop by the WooCommerce Membership of the author
- Custon Content within WordPress Loop
- WP Query ‘posts_per_page’
- 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
- Get data from PHP to JavaScript to set position of each post on front page
- display posts of custom post type with custom taxonomy
- postsperpage value not being applied
- foreach loop inside the loop creating duplicates in output
- How to fetch posts that are stored in the different table than (default) wp_posts?
- Cant’ Display Custom Post Type Title Base on Tax Terms
- Cache issue with WP_Query and custom field filtering
- filter the_content, custom post type, and wp_query
- Loop for custom-post-type comparing taxonomy terms for “related” posts?
- Fill custom fields when saving custom post types
- Writing a custom Glossary plugin
- What is the most efficient way to execute recursive complex queries?
- Custom Form / Search with Custom Post Type Data
- Alike Shortcode using in Custom Shortcode
- Sort custom post column by generated value?
- Unable to gather Image URL from Custom Post Type’s; Custom Meta Field
- Filter posts by their related field’s custom field
- Query a Custom Post Type using SELECT that has ACF fields to compare dates
- Wrapping an unknown amount of posts inside separate HTML Containers during WP_Query loop
- Post Filtered by Custom Field Value
- subtracting the current post form then whole loop, which is generating all CPT titles
- Filter custom WP_Query by first letter of a custom field – hopefully using Search and Filter Pro?
- % encoded URL giving 404 error in WordPress
- Custom post Query and WordPress Post Query Clash
- Meta_Query refuses to return results
- Only show current category post
- Strange behavior on WP_query
- Query events post type after current date and timezone
- Loop with Custom Post Type and Taxonomies
- How to stop wp_query searching pages as well as the specified CPT
- display news with pictures 3 small and one large (loop)
- How can I pull information from my loop and divide them seperately?
- If i have custom post type with 5 custom fields do i have to create a new loop to reference each one?
- 404 on Pages for Custom Post Type & Query_Posts
- Fourth page of custom post type archive page does not exist
- Catergory args causing loop not to show
- Show Posts in Vertical Tabs with Scrollbar
- How do I filter a custom post type loop by a field?
- How to show all posts of specific custom post type with their custom fields values?
- Display ACF object field data using Elementor Custom Query
- WordPress custom field sorting, weird behavior: the latest post is at the end
- How to insert a post from a different post type after every nth post
- Sort CPT by taxonomy AND THEN by custom field
- Complex Custom Loop with Includes
- How to consume external API from WordPress post editor and display the response data in the custom field?