• Hey there,
    what an awesome plugin it works like a charme beside one thing:
    I used the following script for the functions.php

    add_filter('wp_print_scripts', function () {
        wp_script_add_data('pdfemb_embed_pdf_js-js-extra', 'phast_no_defer', true);
        wp_script_add_data('pdfemb_embed_pdf_js-js', 'phast_no_defer', true);
        wp_script_add_data('pdfemb_pdf_js-js', 'phast_no_defer', true);
    	wp_script_add_data('jquery-core-js', 'phast_no_defer', true);
    });

    But the scripts are still used with phastpress. Can you help?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Albert Peschar

    (@kiboit)

    Hey @diesignatur,

    Thanks for trying out PhastPress!

    The -js and -js-extra are not part of the script IDs. If you remove them, I think your code should work:

    add_filter('wp_print_scripts', function () {
        wp_script_add_data('pdfemb_embed_pdf_js', 'phast_no_defer', true);
        wp_script_add_data('pdfemb_pdf_js', 'phast_no_defer', true);
        wp_script_add_data('jquery-core', 'phast_no_defer', true);
    });

    If that doesn’t help, please let me know. ??

    And if PhastPress is working well for you, I’d really appreciate it if you left a review here.

    –Albert

    Thread Starter diesignatur

    (@diesignatur)

    Hey Albert,

    thanks for your fast reply. I used the function like this and it seems to work:

    add_filter('wp_print_scripts', function () {
        wp_script_add_data('pdfemb_pdf_js', 'phast_no_defer', true);
    	wp_script_add_data('pdfemb_embed_pdf_js', 'phast_no_defer', true);
    });

    But unfortunately it doesnt solve my problem. Since activating PhastPress the Plugin “PDF Embed” is not working anymore, so I am trying to exclude it, but for now without any success. Do you have any idea what I am doing wrong? You can see the result here: https://wp-pdf.com/kb/setting-up-fake-worker-failed-error-message/ (the PDF should be embedded but there is only a link now after activating phastpress)

    The Plugin developer has a site about caching-plugins and related errors here: https://wp-pdf.com/kb/setting-up-fake-worker-failed-error-message/ Maybe this helps for your “investigation”.

    I have already unchecked the “Remove query string from processed resources ” setting in phastpress.

    FYI: If I uncheck “Load scripts asynchronously” and “Minify scripts and improve caching ” in my tests the plugin works.

    • This reply was modified 4 years, 3 months ago by diesignatur.
    • This reply was modified 4 years, 3 months ago by diesignatur.
    Plugin Author Albert Peschar

    (@kiboit)

    Hi @diesignatur,

    I’ve tested with PDF Embedder and found the issue. This plugin uses the pdf.js library, which uses the document.currentScript variable to find the URL to itself. This was not yet supported by PhastPress’ script optimizer.

    I’ve just released PhastPress 1.88 which fixes this problem. After updating to this version, it should work fine.

    You can remove your custom filter, it is no longer needed. Also, you can enable “Remove query string from processed resources” and other disabled options, these are now all compatible with PDF Embedder.

    Let me know if this update resolves your issue or if you have any other concerns.

    –Albert

    Thread Starter diesignatur

    (@diesignatur)

    Works like a charm Albert. And outstanding fast support! This is by far the best Pagespeed Optimization Plugin for WordPress and I am quite experienced with Page Speed Optimizations for WordPress over the years.

    The only problem now is that as soon as I turn on WP-Super-Cache its gone again ??

    Plugin Author Albert Peschar

    (@kiboit)

    Hey @diesignatur,

    PhastPress should be compatible with WP Super Cache.

    Have you cleared your WP Super Cache cache after activating/configuring PhastPress?

    –Albert

    Thread Starter diesignatur

    (@diesignatur)

    Yes I cleared the cache before re-activating a few times already. everything else beside the PDF embedder works fine.

    Plugin Author Albert Peschar

    (@kiboit)

    Hi @diesignatur,

    Very strange. It must be due to caching somehow.

    Would you be able to share the URL to your site with me? If you don’t wish to post it publicly, you can find my contact details at the bottom of the plugin description.

    –Albert

    Thread Starter diesignatur

    (@diesignatur)

    Hey Albert, I just sent you the mail and activated the wp super cache again

    Plugin Author Albert Peschar

    (@kiboit)

    Hi @diesignatur,

    I’ve tested with WP Super Cache and it seems that the issue is triggered when you have selected “Expert” mode and also enabled the “Late init” option.? In that case PhastPress optimizations were not stored in the cache, and thus only effective on the first (uncached) pageload.

    I’ve just released version 1.89 which should fix this problem.

    Please try it out and?let me know.? ??

    –Albert

    Thread Starter diesignatur

    (@diesignatur)

    Hi Albert,

    I have just updated to the new version and cleared the cache but the result as you can see is still the same.

    My settings are “simple mode” and “late init” on.

    BTW: When I switch off “late init” it works.

    • This reply was modified 4 years, 3 months ago by diesignatur.
    Plugin Author Albert Peschar

    (@kiboit)

    Hi @diesignatur,

    The final issue is caused by the NextGEN Gallery plugin on your site.

    It uses some logic to reorder scripts and stylesheets which is not compatible with PhastPress and WP Super Cache late init. So one solution is to disable late init, but if you need it on your site, that won’t help.

    So I’ve now released PhastPress 1.90 with a workaround for this issue. It makes sure that the NextGEN Gallery resource manager doesn’t conflict with PhastPress.

    You can install it and let me know if it fixes the issue. ??

    –Albert

    Thread Starter diesignatur

    (@diesignatur)

    Works like a charm Albert. Outstanding support thank you very much!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Exclude Scripts in functions.php’ is closed to new replies.