Performance : Duplicating `add_action`

Well, the short answer is the first item consumes more memory then the second one. One of the reason would be that WordPress hooks uses call_user_func_array() to call al those functions dynamically. And call_user_func_array() actually takes an array as one of its parameter and do a search for a function with this name. So in … Read more

Why are theme templates organized as multiple point of entry PHP files instead of reusing your theme’s index.php?

Theme template files are organized in this way because of the WordPress Template Hierarchy. Since all primary template files eventually fallback to index.php, it is certainly possible to use only the index.php primary template file. There are advantages and disadvantages to using either method. Generally speaking, the usefulness/efficiency of defining template files is inversely proportional … Read more

Two posts are loaded instead of one?

The core of the problem is that you set cookies when the content is being accessed, not when it is read. Browsers can try to prefetch content, and your description sound like the browser is prefecthing the “next” link found in the header. From experience, you should avoid setting cookies on the server and prefer … Read more

WordPress Find Duplicate Post By Content

Try to use the following SQL query to fetch duplicate posts: SELECT p2.* FROM wp_posts AS p1 LEFT JOIN wp_posts AS p2 ON p1.post_content = p2.post_content AND p2.ID < p1.ID AND p1.post_type = p2.post_type AND p1.post_status = p2.post_status WHERE p1.post_type=”post” AND p2.ID IS NOT NULL

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)