Though WordPress has wp-cron functionality to do scheduled tasks, I still like Unix crontab to do them. Fortunately, we can write script programs in PHP to run from a command line even if the scripts call WordPress functions. To do WordPress operation in a script, we have to include ‘wp-load.php’ before the operation. Below is … Continue reading WordPress in command line scripts→
Regarding ‘wp_insert_post’ function, you may want to insert posts with assigned IDs for some reason. Yes, you can do it by using $post->import_id. There is also $post->ID parameter to determine ID. I’ll describe difference between $post->import_id and $post->ID of wp_insert_post. If you want to insert a new post with arbitrary ID, use $post->import_id. If you … Continue reading Calling wp_insert_post to create a post with assigned ID in WordPress→
Though Google recommends responsive web design most, they also support sites which produce different HTML on the same URL depending on user-agent information. My site is the latter. Google’s recommendation to sites like mine is to use ‘Vary’ HTTP header. But with standard installation, WordPress doesn’t set ‘Vary’ HTTP field in HTTP response header. So … Continue reading Modifying HTTP response header in your WordPress site→