Changing Plugin Load Order
Don’t touch the load order, change the activation order instead. A working example can be found in this answer.
Don’t touch the load order, change the activation order instead. A working example can be found in this answer.
WordPress read the templates from file headers, and then set them in the cache. using wp_cache_set() nad a key that is derived from the md5 has of stylesheet folder. So, just overriding that cache we can show the templates we want. To override that cache we need to call wp_cache_set() again using same key. First … Read more
There is no special hook to author change. But you can achieve it by using post_updated hook. Example: add_action(‘post_updated’, ‘prefix_on_update_author’, 10, 3); function prefix_on_update_author($post_ID, $post_after, $post_before) { if ($post_after->post_author != $post_before->post_author) { // author has been changed // you can add your own hook here or write your code } } Here is the codex … Read more
Thumbnails in WordPress can be generated by using wp_generate_attachment_metadata(), this function fires a filter after generating all the thumbnails wp_generate_attachment_metadata and the filter provides $metadata and $attachment_id to the hooked functions. You can hook your custom function to this filter. $metadata : Attachment metadata. What you need is $metadata[‘sizes’][‘<size-name>’], the <size-name> is the name of … Read more
Hi @Jonathan Sampson: There are several plugins to make Custom Post Types easier and some allow you to define Custom Fields too, in no particular order: WP Easy Post Types GD Custom Posts And Taxonomies Tools Custom Post Type UI Simple Fields As I mentioned above I’ve been working on one that does not provide … Read more
Available actions: pre_post_update – Runs just before a post or page is updated. publish_post – Runs when a post is published, or if it is edited and its status is “published”. save_post – Runs whenever a post or page is created or updated, which could be from an import, post/page edit form, xmlrpc, or post … Read more
There is the filter ‘pre_update_option_’ . $option. You have to know the option name. Options can be updated from front-end too, so WordPress doesn’t make a difference here. Then there is an action: ‘update_option’, you get the arguments $option, $oldvalue and $_newvalue. Finally, if the update went successful, you get two further actions: do_action( “update_option_{$option}”, … Read more
With the lastest version of WordPress (4.3) you can now natively remove the customizer’s theme switch setting without resorting to CSS hacks. /** * Remove customizer options. * * @since 1.0.0 * @param object $wp_customize */ function ja_remove_customizer_options( $wp_customize ) { //$wp_customize->remove_section( ‘static_front_page’ ); //$wp_customize->remove_section( ‘title_tagline’ ); //$wp_customize->remove_section( ‘nav’ ); $wp_customize->remove_section( ‘themes’ ); } add_action( … Read more
Have a look at the codex page for add_filter. The 10 is the $priority parameter (10 is default) which defines when your function will run in regards to the other functions which are attached to the nav_menu_css_class filter. 2 is the $accepted_args parameter which tells wordpress how many parameters the function you want to add … Read more
You may want to try: do_action(‘set_object_terms’, $object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids); You can find it under this Docs and the action is located at wp-includes/taxonomy.php add_action(‘set_object_terms’,’wpse5123_set_object_terms’,10,4); function wpse5123_set_object_terms($object_id, $terms, $tt_ids, $taxonomy){ if($taxonomy == ‘category’){ echo ‘<pre>’; print_r($terms); echo ‘</pre>’; exit; } } The code above isn’t tested but I think you get the point.