Calling clean_term_cache() fails when called in the same plugin that creates terms, succeeds when called separately?

After creating about 40 test WP installs today on localhost, here’s what I can report: It appears that the correct function call to rebuild the category_children options is: _get_term_hierarchy(‘category’) Previously, I was trying to call: clean_term_cache(”,’category’) And I was calling it just after my categories were created in my plugin code. However, I could never … Read more

The changes I make to an external JS file of my WP plugin are only applied after I clear my browser’s cache

Use function filemtime($path), where $path is a path to your script, in wp_enqueue_script call, as fourth parameter (version). Every time you modify the script, the cache will be bypassed. Update Calls to wp_register_script and wp_enqueue_script: wp_register_script(‘DynamicMapScript’, plugins_url(‘DynamicMap.js’, __FILE__), array(‘jquery’), filemtime(dirname(__FILE__) . ‘/DynamicMap.js’)); wp_enqueue_script(‘DynamicMapScript’);

Good tools for locating hooks in a wordpress page/admin interface/blog post?

It is usually easy to find most hooks in documentation or source. It can be much more tricky for hooks that are dynamically generated, like post transitions. Essentially it doesn’t exist in source as specific hook – it is hook that is getting generated dynamically at runtime, depending on variables. do_action(“${old_status}_to_$new_status”, $post); do_action(“${new_status}_$post->post_type”, $post->ID, $post); … Read more

How to make my plugin theme-independent?

Shortcode is definitely a good start. It is very flexible in terms of where you output the content (widget, post, page, inside php function, etc). You can also override the template output easily by using action hooks and custom post type that you create: add_action(‘the_content’, ‘add_project_content’); function add_project_content($content) { // Only override the content of … Read more