One day I needed to create a WordPress attachment programmatically. Turns out there are some things to remember, and some mysteries as well. Continue reading
In this post, I present a simple way to check for things on the server before allowing a plugin to be activated.
The users are pesky. They try to do things that the programmer cannot foresee. They happily install plugins without reading the readme files or the instructions. Then they complain, they downvote, they critizice. If only there was a way to check for these things: is the user running the plugin under the correct WordPress version, or if the necessary dependendencies are installed, or if PHP was compiled with such-and-such extensions. Then we’d let the user know about all this at the plugin activation time. What if this ability was coded as an easy-to-add drop-in class, instead of bloating existing plugin code? I couldn’t find it, so I made it, and now I’m sharing it with you. Continue reading
Something happened on the way to PHP heaven. A customer reported a fatal error where my unit tests caught none… Continue reading
pclose( popen( 'start /b ' . $path_to_php_exe . ' -f ' . $script_filename . ' -- ' . $args, 'r' ) );
Now something important to note: any output from your script will prevent the above from working, including error messages. The PHP process will hang on the background and waits for you to
fread() the output. Also double-check the quotes and escaping in your filenames and arguments!