Website Loads Twice Unnecessarily

As I’ve found, this happens when your html, css or javascript tries to load a resource and you haven’t specified a path or wrongly specified root. For instance, I’ve seen examples on people having this problem while doing <img src=”http://example.com” /> background:url(); In my case specifically, was assigning $.ajax() to a global variable so I … Read more

How to build a plugin that supports authenticated POST requests to the REST API from external servers?

Answering my own question. For plugin developers, the directive is to use current_user_can() in your code as usual in the REST endpoints, as Core does. WordPress 5.4 does not support authenticated requests originated from outside WordPress to the REST API yet. But your clients can use plugins such as Basic Auth, OAuth2 or JWT to … Read more

Serving wp-includes (front-end) javascript from a different domain?

Okay, I’ve tried numerous (literally) codes and methods, and failed miserably. So, like I said in the question, the only safe way seems to be re-registering (unregistering and enqueuing) the scripts. The Scripts: http://mywebsite.com/wp-includes/js/comment-reply.js http://mywebsite.com/wp-includes/js/quicktags.js Should be served from: http://example.com/wp-includes/js/comment-reply.js http://example.com/wp-includes/js/quicktags.js Code in functions.php: add_action(‘wp_enqueue_scripts’,’wpse56742_register_script’); function wpse56742_register_script(){ //Register and enqueue Comment Reply script wp_deregister_script(‘comment-reply’); wp_register_script(‘comment-reply’, … Read more

How to detect that site is hosted on WPEngine?

From a quick look at wpengines headers it looks like there may be some info you can check. Your best bet is to get access to an account and dump out $_SERVER to see what’s in there. For example it looks like $_SERVER[‘SERVER_NAME’] = ‘WP Engine/4.0’. or perhaps $_SERVER[‘HTTP_HOST’]. As per the comments below it … Read more

Set a cookie in WordPress, using a select form and Jquery

If you don’t give the cookie an expires time it will only be available during that session. You will also need to destroy an existing cookie if it is already set. jQuery(function() { jQuery(‘#categoriesform’).submit(function(e) { if (jQuery.cookie(‘my_cookie’) ) { jQuery.cookie( ‘my_cookie’, null) } jQuery.cookie(‘my_cookie’, ‘my_value’, { expires: 30 }); }); }); Have you tested to … Read more

Worpdress PHPSESSID / EU law

The cookie looks like it is being set by the PHP session handling process. WordPress ‘out of the box’ doesn’t use sessions, which would seem to point towards either your theme or a plugin. If you search your code base for ‘session_start’ you may be able to track down where the session is being initiated. … Read more

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