Support » Plugin: Smush - Lazy Load Images, Optimize & Compress Images » Last Update – problem with add images – TypeError

  • Resolved Kris Kelvin

    (@kanlukasz)


    After latest update i have a problem with your plugin

    Something is wrong because console said:
    “TypeError: wp.api.models.Media is not a constructor” media.js:93:15

    it happens when i tried to add new photo to woocoomerce product

    Screenshot error

    Wp – latest ver
    Woocoomrce – latest ver
    Yoast – latest ver
    Template – my own but simple
    and your wp smush

    if you need more info, let me know

    edit:// in Media in another project (without Woocommerce) is problem too

    • This topic was modified 3 years, 2 months ago by Kris Kelvin.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Anton Vanyukov

    (@vanyukov)

    Hi @kanlukasz,

    Could you please tell which version of WordPress and WooCommerce you are using?

    Best regards,
    Anton

    Thread Starter Kris Kelvin

    (@kanlukasz)

    Hi Anton

    As I wrote, these are the latest versions

    WP 4.9.7
    Woo 3.4.4

    note that this is not just happening where Woocmmerce is.
    In another project where i don’t use Woo is problem with Media library

    And if i disable Wp Smush – everything is ok

    //Edit: i forgot about ACF. In all of my projects i use ACF

    • This reply was modified 3 years, 2 months ago by Kris Kelvin.
    • This reply was modified 3 years, 2 months ago by Kris Kelvin.
    Plugin Author Anton Vanyukov

    (@vanyukov)

    @kanlukasz,

    Do you, by any chance, have any plugins that disable the WordPress REST API?

    Best regards,
    Anton

    Thread Starter Kris Kelvin

    (@kanlukasz)

    No but i have blocked rest api in htaccess, is that a problem?

    My code:

    RewriteCond %{REQUEST_METHOD} ^(GET|POST|PUT|PATCH|DELETE) [NC]
    RewriteCond %{REQUEST_URI} ^.*wp-json/wp/ [NC]
    RewriteRule ^(.*)$ - [F]
    Plugin Author Anton Vanyukov

    (@vanyukov)

    @kanlukasz,

    It might, because the latest Smush version has Gutenberg integration and Gutenberg heavily relies on the REST API. Could you please try to remove the block?

    In any case, you should not be blocking REST API, because many services/plugins rely on it. And from WordPress 5.0, you’ll have a lot of issues if you block it. It is not a security risk.

    Best regards,
    Anton

    Thread Starter Kris Kelvin

    (@kanlukasz)

    i made quick test and its look like you right.

    I think good idea will be removed my htaccess rewrite and use instead rest_authentication_errors ( https://developer.wordpress.org/rest-api/using-the-rest-api/frequently-asked-questions/ )

    what do you think?

    Plugin Author Anton Vanyukov

    (@vanyukov)

    @kanlukasz,

    That should work. But, personally, I see no point doing so. REST API does not expose anything that is not already exposed on your site.

    Best regards,
    Anton

    Thread Starter Kris Kelvin

    (@kanlukasz)

    ok, I will consider your point of view

    Anyway i will make some tests today.
    if everything is ok, of course I will mark the thread as solved

    Thank for your help and quick response!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Last Update – problem with add images – TypeError’ is closed to new replies.