Support » Plugin: Sniplets » [Plugin: Sniplets] New post bug

  • Hello,

    the JS file for this plugin is not loaded when writing a new post. That makes the sniplets meta box and also rest of the inline JS non-functional.

    Please make sure to fix sniplets.php, line 150 from:

    if ( (isset($_GET['page']) && $_GET['page'] == 'sniplets.php') || strpos ($_SERVER['REQUEST_URI'], 'page.php') || strpos ($_SERVER['REQUEST_URI'], 'post.php')) {


    if ( (isset($_GET['page']) && $_GET['page'] == 'sniplets.php') || strpos ($_SERVER['REQUEST_URI'], 'page.php') || strpos ($_SERVER['REQUEST_URI'], 'post.php') || strpos ($_SERVER['REQUEST_URI'], 'post-new.php')) {

    That adds check for /wp-admin/post-new.php address and loads the required JS.

    Plugin version: 1.4.4, 1.4.5.


Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi FolioVision
    I was looking for the same. I was having trouble inserting images into new posts, because the lightbox never worked, etc.

    I firebugged and discovered it was due to Sniplets.

    I’m using the 1.4.5 version and fixed the bug in the following lines: 250 and 258 (but nothing found at line #150)

    Thanks for the fix!


    I have the same problem on WP3.3 with Sniplets. I’ve tried the fix but does not work unfortunately.

    I suppose that jQuery and jQuery UI update on WP3.3 make this problem happened. Anyone knows how to fix this?


    There are two fixes for this issue from what I’ve seen. One uses FolioVisions update as described above. WordPress changed the URL for new posts to “post-new.php”. So that’s one. Another change has to be made to the admin.js file in the resources folder of the Sniplets plugin.

    If you replace lines 231 to 239 with these line it’ll get your edit page working. It won’t however add in the sniplets button to your toolbar. I’m not sure what button the original developers code is trying to clone. Then again we have a new solution and won’t require sniplets in our next site release.

    if (but) {
    		while (but.nodeType != 1)
    			but = but.previousSibling;
    		but = but.cloneNode (true);
    		but.value = 'sniplet';
    		but.title = edButtons.length - 1;
    		but.onclick = function () {edInsertTag(edCanvas, parseInt(this.title));} = "ed_sniplet";
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Sniplets] New post bug’ is closed to new replies.