Support » Plugin: YAK for WordPress » fix jquery-tools dependence (patch proposed)

  • Hi,
    Currently, YAK causes jQuery Tools to be loaded on all WP admin pages, thereby breaking an important Drag & Drop functionality in NextGEN gallery.

    I have temporarily solved this problem by replacing the line 1420 in yak-for-wordpress.php, which was

    wp_enqueue_script(‘jquery-tools’, “$yakurl/”);


    $url = $_SERVER[“REQUEST_URI”];
    if (yak_str_contains($url, ‘yak’))
    wp_enqueue_script(‘jquery-tools’, “$yakurl/”, null, null);

    One can certainly do better, i.e. do the same for other files that need to be loaded only when visiting the YAK settings pages, or provide a better way of checking whether we are on the YAK settings page.

    Note that I also changed the wp_enqueue_script line, because with the old line, WordPress would append its version string to the file, such that it could not be found anymore.

Viewing 6 replies - 1 through 6 (of 6 total)
  • By the way, thanks for this great plugin!

    Plugin Author nolongeractive


    Which version of YAK are you using? Because this check has been in place for quite a while — the logic is arguably in the wrong place (it’s in yak-admin.php, rather than yak-for-wordpress), but it’s working as expected (I just double-checked). is currently loaded on all YAK admin pages, and also on the edit/add post pages – but nothing else. If the NextGEN drag-and-drop functionality is on the edit/add screens, I guess that’s why it’s failing.

    That said, I can’t think of anything I use in jquery tools on the edit post, so perhaps that was overkill. Let me know and I’ll amend the code accordingly.

    Thanks for the quick reply. I use YAK 3.4.8.

    jquery tools is loaded on many more WP admin pages than those you mention, among them the NextGEN settings pages. The reason is the check at line 1034 of yak-admin.php

    $url = $_SERVER[“REQUEST_URI”];
    if (yak_str_contains($_REQUEST[‘page’], ‘yak’) || yak_str_contains($url, ‘post’) || yak_str_contains($url, ‘page’))

    It lets through requests such as


    presumably because they contain the string “page” (are the GET parameters included in the URI? )

    Maybe you want to check for the string “post_type=page” instead.

    If would be nice by the way to be able to specify the (custom) post types where the YAK interface is loaded.

    Thanks and keep up the good work!

    Plugin Author nolongeractive


    Ah good point. Not sure why I didn’t see that when testing. Will update for the next release.

    Cool, that’s great.

    Maybe you didn’t see it because of different implementations of the $_SERVER variable? (I am new to PHP, I don’t know about it)

    Please also add then the two null parameters to the wp_enqueue_script function. Although it seems to me that even without them the inclusion of jtools used to work at some point, it currently does not on my system, which is the behaviour predicted by the wp_enqueue_script documentation.

    Will you also add support for choosing the custom post types where the YAK interface is loaded? I could help you on this if you wish.

    I would also be happy to have a look at your changes before you release the new version.

    Plugin Author nolongeractive


    This should be fixed in the latest release btw.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘fix jquery-tools dependence (patch proposed)’ is closed to new replies.