Articles of duplicates

Duplicates with WP_Query loop

I’m showing on my front page only posts with featured image. My problem is that on every next page load I receive the same results aka getting duplicates. I’m using ordering by custom field. Any directions/ideas what may lead to this problem are welcome. Below is my main loop // Layout if(is_category()) { $post_layout = […]

Performance : Duplicating `add_action`

If was wondering about PHP performance on WordPress, If I had many duplicate add_action. add_action( ‘init’, ‘func_a’ ); add_action( ‘init’, ‘func_b’ ); add_action( ‘init’, ‘func_c’ ); //… so on vs add_action( ‘init’, ‘func_init’ ); function func_init() { function_a(); function_b(); function_c(); //… so on } The first one should be a problem with performance if I […]

Save both current and new version of post meta

I want to save two versions of my custom meta box data called “sidebar”. I want to compare a new and old version of this data later on, so that is why I want to save a copy of the current “sidebar” to a field called “sidebar_old”, just before saving a new version. Here’s my […]

Duplicate posts being displayed when querying Custom Fields

I have created a small segment within WordPress that records match information for League of Legends. Using up to 30 different custom fields I can store information of 30 champions picked from 3 games (10 different champions are picked each game) I want to query all games the champion ‘Shen’ has played in but the […]

Prevent duplicate post from dynamic multiple loops

I was trying to list 20 recent posts, and put a post from custom post type on every 5th item. So it’s like: Post Post Post Post Post Custom Post Type Post Post Post Post Post Custom Post Type .. and so on. Here’s what I did so far. It’s working but the custom post […]

Problem:Save Several Duplicate posts in The Database and then Error nesting level of '100' reached

I have a function to insert a single post in the database. But when I run the function, duplicate posts (40) are added to the database and then an error is displayed. Fatal error: Maximum function nesting level of ‘100’ reached, aborting! in C:\wamp\www\wordpress\wp-includes\cache.php on line 671 I would like it so that each time […]

WordPress Find Duplicate Post By Content

Is there any way to find similar/duplicate wordpress posts by post_content. I have tried “Find Duplicates” plugin but it takes a lot of time to search since I have more than 7000 posts in my database. What I want to achieve is search the posts published in current week with all the old posts and […]

Two posts are loaded instead of one?

I am trying to add a read posts function to my WordPress website. To achieve this, I create a cookie on which I store all the IDs of read posts. Every time a post is loaded, the following function is fired : function readPosts() { if (is_single()){ $postId = get_the_id() . “/”; $cookie = empty($_COOKIE[‘readposts’]) […]

If the only permalink setting is %postname% what happens in the case of old duplicates?

I am tempted to change my blog to be I know that for new posts WordPress is smart enough to add a unique number to them, but what about old posts that would get updated? I can run a database check for duplicates and manually fix them but I was wondering if this was […]

How do I check for a duplicate record before inserting using wpdb

I am inserting a row into a custom table in a wordpress database. this is the code: $wpdb->insert( ‘wp_pl_my_parts’, array( ‘user_ID’ => $user_ID, ‘PL_part_ID’ => $PL_part_ID, ‘part_save_date’ => $part_save_date ), array( ‘%d’, ‘%d’, ‘%s’ ) ); How do I make sure I do not insert a duplicate entry. Ie. I don’t want it to insert […]