Taxonomy archive + query attachments = duplicate results

I think the problem is that you’re passing the wrong arguments to the $attachments query, causing you not to get the intended posts in the $attachments query. Here’s what you’re doing: $args = array( ‘post_status’ => ‘inherit’, ‘numberposts’ => 0, ‘post__not_in’ => array_merge($do_not_duplicate,get_option( ‘sticky_posts’ )), ‘post_type’ => ‘attachment’, ); $args[‘tax_query’] = array( array( ‘taxonomy’ => … Read more

$wpdb->prepare with ON DUPLICATE KEY UPDATE

It’s my fault. Got the solution after @Otto’s comment: Do you actually have a duplicate key here? What is the structure of user_req and what are the keys and indexes? Here’s how my SQL query should be: INSERT INTO {$wpdb->prefix}user_req ( user_id, post_id ) VALUES ( %d, %d ) WHERE NOT EXISTS ( SELECT * … Read more

Translate pages and URLs without duplicating

The first question here is why don’t you want to duplicate your pages? I would very much advise to use a plugin like PolyLang or WMPL that do exactly that. qTranslate X is a plugin that does not duplicate pages. It just copies the content of all translations into one post. https://de.wordpress.org/plugins/qtranslate-x/