Hook for post and page load

You can use the wp hook and check the global $wp_query object or any conditional. add_action( ‘wp’, ‘wpse69369_special_thingy’ ); function wpse69369_special_thingy() { if ( ‘special_cpt’ === get_post_type() AND is_singular() ) return print “Yo World!”; return printf( ‘<p>Nothing to see here! Check the object!<br /></p><pre>%s</pre>’, var_export( $GLOBALS[‘wp_query’], true ) ); } See: wp in codex.wordpress.org and … Read more

Custom templates not showing up in template dropdown

Just in WordPress 4.9 there’s this bug: https://core.trac.wordpress.org/ticket/42573 causing the template files to only be rescanned once every hour. To fix (until they release a new WP version with this changed), download the patch on that bug ticket and make the changes from the patch to wp-includes/class-wp-theme.php. Hope this saves someone the 2 hours I … Read more

Contact Form on WordPress Sites?

Contact Form 7 is one of the most popular plugins to add a contact form to a WP blog. It supports multiple contact forms and you can add/remove fields as needed. Additional services such as reCAPTCHA and Akismet can be added. I use this on most of my blogs to power the contact features.

Sending the reset password link programatically

So if you want to send the reset password link and you have access to the code base, you can use the following snippet and you can modify it further. Actually this code is a slightly modified version of wp-login.php /** * Handles sending password retrieval email to user. * * @uses $wpdb WordPress Database … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)