HTTP access control (CORS)

if ($request_method = POST) {
        add_header Access-Control-Allow-Origin *;
        add_header Access-Control-Allow-Methods “POST”;
        add_header Access-Control-Allow-Headers “Authorization”;
        add_header Access-Control-Allow-Credentials “true”;
        add_header Content-Length 0;
        add_header Content-Type text/plain;
        return 200;

Register Activation Hook not working

No, this is not like the several other dozen posts I read of people struggling with the WordPress register_activation_hook, but almost.

I spent an hour trying to figure out why, despite following numerous instructions and troubleshooting steps, that this would not work.

Some setup details:

OS – Windows 7

Server – Xampp’s portable lamp stack

The core WordPress files are all in Xampp’s C:\xampp\htdocs while the theme and one of the plug-ins is being symbolically linked into the web server directory. This is because I have all of my code that is under Git control in one place, and I just symbolically link it into wherever I need it to run.

Initially I thought it was because I was using Windows. I even found a bug ticket from 5 years ago saying register_activation_hook doesn’t work on Windows because of path separators. That ticket had long been in the fixed state though and I didn’t see any more recent ones.

I did some quick debug echos of where php thought everything was located and sure enough, because it is symbolically linked into the wp-content/plugins folder, it was interpreting the plug-ins existence as being in the Git folder and not the server folder under all of the rest of the WP stack.

Some piece of this (still under investigation), made it impossible for the register_activation_hook to fire. It has to be isolated to the register_activation_hook function in the wp-includes/plugin.php file. As soon as I made it activate on the init action, everything worked. As well as, installing this plug-in on a linux server without using symbolic links, the register_activation_hook worked.


Ubuntu – Kill zombie processes

for each in `ps -j auxww | grep Z | grep -v PPID | awk ‘{print $3}’`; do for every in `ps auxw | grep $each | grep cron | awk ‘{print $2}’`; do kill -9 $every; done; done


sudo ps -fe | grep -i “defunc” | awk {‘print “kill -9 “$3’} | sudo sh