• Resolved alx359

    (@alx359)


    Have been skimming through the code for a suitable hook to call PP onto a piece of HTML code that’s displayed via Ajax. Specifically, wish to apply PP’s URL img rewrites to that HTML before the output reaches the browser. For example:

    <img src="https://www.domain.com/wp-content/plugins/phastpress/phast.php?service=images&src=https%3A%2F%2Fwww.domain.com%2Fwp-content%2Fuploads%2Fimage-247x296.jpg&cacheMarker=1597860358-49645&token=2386095927150b52" class="attachment-woocommerce_thumbnail size-woocommerce_thumbnail" alt="image" loading="lazy" title="image" width="247" height="296">

    Can you please tell an example of how to achieve that programmatically via a hook? Thanks.

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

    (@kiboit)

    Hi @alx359,

    I’ve added a helper function for this in the latest release 1.102. Update, and then try this:

    $optimized_html = phastpress_optimize_snippet("<img src='...'>");

    Let me know if this doesn’t do the trick.

    –Albert

    Thread Starter alx359

    (@alx359)

    It works, thank you so much! ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Applying PP programatically on HTML’ is closed to new replies.