Articles of automation

Posts to expire (deleted) after a date

I am creating a coupon site from scratch. I have reviewed many code examples on the Internet, but have not found anything that will work, as my requirements are little different. I need help in creating an expiry function that would delete the “coupon” (post_type) automatically. As a coupon site, all coupons are imported in […]

Send email to Admin when user/member updates specific user/member data

I have previously asked about How to automatically send email to Admin when a user/member changes his/hers profile data. And got some very good answers. Send automatic mail to Admin when user/member changes/adds profile Now a follow up: I only want to send/email the data (profiledata) that was updated/added.

Scrape data from a website and post it on the blog

This could be in DocType, but I’m looking for a way to scrape data and post it automatically. I wanted to fetch those data from a website and automatically post it on my blog. It doesn’t have rss or an API to get those data, so I need to manually copy and paste it one-by-one […]

Automatically create child pages when saving a (parent) page

I have a bit of a tricky one… I have a hierarchical Custom Post Type (‘shows’) that represents events. Is it possible for the user to create a new page (ie show), save the page and for WordPress to automatically create a defined set of child pages with defined names? Ideally each child page would […]

Generate WP-CLI @alias for each site on multisite

I have a few multisites, each with several sites, that I want to auto-generate @aliases for. Is there way to sync those sites as aliases in my site list? I’d like to be able to target a single site without having to specify –url= and using the last part of the url seems like a […]

XMLRPC and Underscored custom fields

I was creating my application to automate all of my blogs from my desktop. Target, I’ll post blog. That’s all. I used XMLRPC service, as you know “xmlrpc.php”. I built many of parts, near to done… But stucked at custom fields which are starting with (_) an underscore. I would like to save as “_thumbnail_id” […]

Send automatic mail to Admin when user/member changes/adds profile

Is there a way to send the updated/added values from profile, when a member/user updates his/hers data, to the admin of the site or another emailadress? Can this be the first step? /* do something when user edits profile */ add_action(‘personal_options_update’, ‘notify_admin_on_update’); function notify_admin_on_update(){ // send a mail with the updated values to exit; […]

Automating deprecated call checks?

I’ve recently started revamping and re-releasing some abandoned (yet important) WordPress plugins. As I walk through the code patching other bugs, my IDE highlights deprecated function calls for me, which is fantastic! I fix them immediately when I find them and move on. Anything I don’t catch is called out by a Log Deprecated Calls […]

Multisite/network–automatic self-registration, blog setup

I am creating a WordPress Network multisite blog in a university environment. It’s set up in subdirectory mode, so that each new blog appears as a subdirectory off a common domain name. The Network authenticates against our corporate Active Directory using LDAP. Only Active Directory users may sign in. The first time a user signs […]

How to add/assign or change featured image in post programmatically?

I have written a plugin that (besides other functionality) makes posts from existing content. For each post I have one picture – how to make them featured programmatically? I do the: $id = wp_insert_post( $my_post ); wp_set_object_terms( $id, $cat_ids, ‘category’ ); and I would like my next step to be inserting $image (file path or […]