I am grappling with implimenting jQm on wordpress and have hit the obstacle that most plugins dont work on jQm ajax loaded pages.

However, taking the example of the sharethis plugin, I have found that it will run on the ajax loaded page if I change this

add_action('wp_head', 'st_widget_head');

to this

add_action('wp_footer', 'st_widget_head');

in the sharethis.php file

The thing is that I want to try and do this leaving the initial plugin files untouched (so that wp updates will work and so that I can keep all my jQm specific plugin modification changes in one place- so they can all be turned off if jQm is turned off)

So I think what I n eed to make to begin with is a plugin that loads last, that moves any plugins I specify to move their add_action wp_head to add_action wp_footer.

I appreciate this is currently a very brute force solution, but so far this is the only chink of light I have found in what seems to be an impenetrable situation, which otherwise requires re-writing all the plugins I use to work with jQm.

So any ideas on this would be very helpful in helping me create a more solid and maintainable solution to this, something like a 'jQm plugin fixer plugin' that I and the community could develop and maintain...

1 Answer 1


Remove the action, then add it back on a different hook.

I think the only concern you could have with doing this is ensuring you do that late enough for the action to have been hooked, it should possible using the plugins_loaded hook(because that runs after plugins have loaded).

add_action( 'plugins_loaded', 'juggle_sharethis_action' );

function juggle_sharethis_action() {
    remove_action( 'wp_head', 'st_widget_head' );
    add_action( 'wp_footer', 'st_widget_head' );


Adding actions

Removing actions

  • Fantastic, I'll try that. Thanks so much for your quick response and the extra info. I'll keep this updated with my progress... Dec 2, 2011 at 13:01
  • You're welcome, let me know how you get on.
    – t31os
    Dec 2, 2011 at 13:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.