• Resolved markcummins

    (@comminski)


    The rtMedia plugin is calling the wp_localize_script function incorrectly. The function should be passed an array, but instead, the rtMedia plugin is passing a string.

    For example, in buddypress-media/app/main/RTMedia.php,

    
    wp_localize_script( 'rtmedia-magnific', 'rtmedia_load_more', __( 'Loading media', 'buddypress-media' ) );
    wp_localize_script( 'rtmedia-main', 'rtmedia_empty_activity_msg', __( 'Please enter some content to post.', 'buddypress-media' ) );
    wp_localize_script( 'rtmedia-main', 'rtmedia_empty_comment_msg', __( 'Empty comment is not allowed.', 'buddypress-media' ) );
    

    The wp_localize_script function should only be called once and the strings should be passed as an array e.g.

    
    wp_localize_script( 'frontend-ajax', 'frontend_ajax_object',
      array( 
        'ajaxurl' => admin_url( 'admin-ajax.php' ),
        'data_var_1' => 'value 1',
        'data_var_2' => 'value 2',
      )
    );
    

    I noticed this after upgrading to php8, as there are a lot of php warnings in the error_log now. It seems to be happening with rtmedia-main and rtmedia-backbone translations

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Javascript String Translation Errors’ is closed to new replies.