Fetching latest posts from 2 different WP installations

I’d use the REST API to get the latest 10 posts from each install, then combine the two arrays, sort them by the date, and then only use the latest 10 results. $editorials = wp_remote_get( ‘https://www.example.com/editorials/wp-json/wp/v2/posts/’ ); $news = wp_remote_get( ‘https://www.example.com/news/wp-json/wp/v2/posts/’ ); $editorials = json_decode( $editorials[ ‘body’ ] ); $news = json_decode( $news[ ‘body’ ] … Read more

Why does WP load so many files in the head of source code? How do I optimize it?

First of all, search this site. This questions has been answered many times in the past: https://wordpress.stackexchange.com/search?q=clean+wp_head and https://wordpress.stackexchange.com/search?q=security+obscurity Secondly, there is a difference in what WP loads and what a theme and a plugin will load. Look in the theme functions file to see what the theme loads, i.e. javascripts and CSS. Look in … Read more

wp-load.php redeclares classes

The problem happens when you have a function declared in the root file of the plugin or in the functions.php file of a theme. You need to require_once a file for functions and move those functions into that file. For example: Your plugin is called some-plugin and the root file is some-plugin.php. Any function on … Read more

WP_load, shortinit for wordpress Ajax

You should be using admin-ajax.php for your AJAX requests and WordPress has pretty good wrappers and actions to help you do that. In terms of performance, 3-4s is pretty harsh. WordPress will typically serve a non-cached request in about 300ms out of the box, so some other theme or plugin is adding to that time, … Read more

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