WordPress and enclosures

When you publish or update a post in WordPress, it checks the post body for any audio or video URLs. If any are found, WordPress creates an _encloseme row (pointing to the post ID) in wp_postmeta and schedules a one-time WP-Cron event.

This WP-Cron event looks for any _encloseme fields in wp_postmeta and for each one it finds, fetches any of the found audio or video URLs to determine file size and MIME type. It then inserts this data as a enclosure post meta variable and deletes the _encloseme.

When rendering any RSS/Atom feeds, these enclosure post meta variables are included as <enclosure> elements.

Safely remove hosts from known host list

$ ssh-keygen -R <host>

This is useful if a host changes their SSH keys and you need to get their new ones.

Reset ID sequences in PostgreSQL


This is useful if you DELETE FROM <table> a bunch of data and also want the sequence to start from the default value next time you start inserting data.

Get the “Posts page” in WordPress

$blog = get_option ( 'posts_for_page' );

You can designate a given page as the “Posts page” in a WordPress site. If you need access to this page, use ‘posts_for_page’ to avoid hardcoding page lookup parameters.