Home Forums WoodMart support forum Lottie files doesn’t let pages/posts to be saved.

Lottie files doesn’t let pages/posts to be saved.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #635764

    sent1nelkosa
    Participant

    Hi,
    I am facing a problem with saving lottie files on any page or post. When i try to add a lottie file either using a 3rd party plugin or even if i disable all plugins except the core ones and i add the lottie file using embed code the save button doesn’t work . When i click it doesn’t save the page and just blinks without doing anything else. If i remove the lottie code the problem is resolved instantly without page refresh. I use gutenberg only without elementor or wp page bakery .
    Thanks

    • This topic was modified 3 hours, 30 minutes ago by sent1nelkosa.
    #635767

    sent1nelkosa
    Participant

    UPDATE:
    Got it fixed using a small trick . I added on my functions.php this code
    add_filter( ‘rest_authentication_errors’, function( $result ) {
    if ( true === $result || is_wp_error( $result ) ) {
    return $result;
    }
    return true;
    });
    It was a blocked REST API error that was caused from some unknown plugin or something probably . No idea what was the source. I am using hostinger professional cloud hosting and it’s not the first time i have had this problem. I am really glad i found a solution for this annoying issue.

    Note: This is a temporary fix !!!!!!!!!!! After finish saving the plugin you should remove that code. What this does is disabling authentication checks for rest api so be extremely careful!!

    • This reply was modified 2 hours, 49 minutes ago by sent1nelkosa.
    #635773

    sent1nelkosa
    Participant

    searching for an actual solution i modified it further adding this instead .

    add_filter( ‘rest_authentication_errors’, function( $result ) {
    if ( true === $result || is_wp_error( $result ) ) {
    return $result;
    }

    $allowed_routes = [
    ‘/wp/v2/posts’,
    ‘/wp/v2/pages’,
    ‘/wp/v2/categories’,
    ‘/wp/v2/tags’,
    ‘/wc/v3/products’,
    ‘/wc/v3/products/categories’,
    ‘/wc/store/cart’,
    ‘/wc/store/checkout’,
    ‘/jet-engine/v1/query-builder’,
    ];

    $current_route = $_SERVER[‘REQUEST_URI’];

    foreach ( $allowed_routes as $route ) {
    if ( strpos( $current_route, $route ) !== false ) {
    return $result;
    }
    }

    // Block everything else unless user is logged in
    if ( ! is_user_logged_in() ) {
    return new WP_Error( ‘rest_forbidden’, __( ‘REST API access denied.’, ‘text-domain’ ), array( ‘status’ => 403 ) );
    }

    return $result;
    });

Viewing 3 posts - 1 through 3 (of 3 total)