How to efficiently find “duplicate” posts, where the titles are different, using metadata to match posts?
How to efficiently find “duplicate” posts, where the titles are different, using metadata to match posts?
How to efficiently find “duplicate” posts, where the titles are different, using metadata to match posts?
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
1st step: clear yourself about how you want to retain the existing content. For example: a contact page on website1.com might be having /contact/ permalink and on website2.com the permalink could be same. So, when you migrate /contact/ from website2 to website1, what do you want WP to do if not overwrite then, it changes/appends … Read more
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
Please Note: Doing this will be very slow! It would be much better to do one (or preferably both) of the following instead: Use wp_cron to do this on a regular basis Instead of grabbing all comments, the first time it runs set at timestamp in the options table after it completes. Each time afterwards, … Read more
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
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
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
If you have several posts with the same value, but you want only the most recent ones with any value, as long as values don’t get repeated, you’r best bet might be running two loops on the same query: /* Fetch all possible values – use this to order the results and define which get … Read more
There is no such thing as “URL that doesn’t exist” URL’s are just possible identifiers for pages on the internet. Every combination of characters as defined by the URL standarts is a valid URL. You can’t control what URLs people are using to find content, if they want to use URLs for content that do … Read more