Cannot override hooks.php

hooks.php is not a file that belongs to any native WordPress convention. While copying files from parent theme is often mentioned as a technique it only applies to template files, which are part of template hierarchy (native or properly customized one). Your guess that this is issue of timing is probably accurate. It’s a little … Read more

How to Show Different Information to your authors/contributers

We will use the admin_notices hook to display the information on top of the editor. First, a very basic example function educadme_fill_then_save_admin_notice(){ global $pagenow; if ( $pagenow == ‘post.php’ || $pagenow == ‘post-new.php’ ) { echo ‘<div class=”alert”> <p>This is some text. You can embed images, videos, whatever, and they will display on top of … Read more

Using actions, hooks and filters in a non-WordPress page

It’s catch 22 – you need WordPress to use the hook system, but init will have already fired during load (wp-settings.php to be exact). I would create a MU “Must Use” plugin (wp-content/mu-plugins/any-filename.php) for all your “outside of WordPress” functionality, with something like this at the start: if ( ! defined( ‘LOADED_EXTERNAL’ ) || ! … Read more

Get new (not old) post inside transition_post_status hook

According to the Codex, if you use wp_transition_post_status() you will get both the old version and the new version. wp_transition_post_status( $new_status, $old_status, $post ) The ticket also says that the post type needs to support revisions for the save to work. Check the post type of the post objects before doing anything. If your post … Read more

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