I’ve been using AJAX taxonomy/post filtering for the past week and just noticed something really strange upon further testing. When you select the filter criteria and click FILTER, it populates the proper posts; however, a random mix of the content that is populated has broken links in there custom metadata. Example: When you visit the Restaurants page, it shows ALL restaurants with all of the respective metadata for the custom post type (such as description, Featured Image, Website link, and social media links) until you click one of the filter criteria (like Delivery, Pet Friendly, etc.). Once you click the filter criteria and submit it, the filtered content loads; however, a random amount of the restaurants have broken website and/or social links. It’s super strange. Upon inspection of the code in Chrome, it looks like the link doesn’t break but instead closes before the icon element…something that doesn’t happen UNTIL the AJAX script runs. See below for the code in various folders/files…You can also view a live example here: https://dpc.grgs.co/location-type/restaurants/.
Code in the CPT template which includes the filter form
Code in functions.php
Script for AJAX filtering
Any help is greatly appreciated!