Taxonomy entries are spawning copies of existing entries with the new title as the existing ID, since upgrade

I’ll answer this myself, though kudos to @jacob-peattie for noticing the selection box was non-standard and a likely culprit. So we had the ‘Radio Buttons for Taxonomies’ plugin running (up to date) with the affected taxonomy types selected there. When we removed the taxonomies from there, the problem stopped. But we wanted radio buttons here … Read more

Prevent duplicating specific column from database table

This is more of a general PHP question than a WordPress one. Use an array with the county as a key to group up your results. $groups = array(); foreach( $results as $result ) { $groups[$result->county][] = $result; } var_dump or print_r on $groups to see how this groups up your results. You can then … Read more

ACF Field to set Publish Date – Post Duplication upon Update

Drew, one thing about your code above is that the word dateAllergy should be in quotation marks like. I’m not sure of that is the problem but it’s worth changing. $datefield = get_post_meta($post_id, ‘dateAllergy’ ,true); Also, I just noticed that your $post_id variable will be empty too. You should change that to $post->ID. That would … Read more

prevent display duplicate titles on main page

Your code should look like this to exclude duplicate titles <ul> <?php // Initial counter for displayed posts. $counter = 1; // Initial empty array of displayed titles. $titles = []; $portfolio = new WP_Query([ ‘post_status’ => ‘publish’, ‘post_type’ => ‘post’, ‘cat’ => ” . $link1 . ”, // Because we don’t know the number … Read more

Custom product loop avoiding duplicates

Using the developers’ reference example, you are referencing $loop redundantly. Drop the $loop-> before the_post() and have_posts(): if ( have_posts() ) { $term_names = array(); while ( have_posts() ) { the_post(); $myPostID = get_the_ID(); //Uncomment next 3 lines to debug using your error log //ob_start(); //var_dump($myPostID); //error_log(‘myPostID = ‘ . ob_get_clean(),0); $arrProductTerms = wc_get_product_terms( $myPostID, … Read more