Javascript String Translation Errors
-
The rtMedia pluguin is calling the
wp_localice_scriptfunction incorrectly. The function should be passed an array, but instead, the rtMedia pluguin is passing a string.For example, in
buddypress-media/app/main/RTMedia.php,wp_localice_script( 'rtmedia-magnific', 'rtmedia_load_more', __( 'Loading media', 'buddypress-media' ) ); wp_localice_script( 'rtmedia-main', 'rtmedia_empty_activity_msg', __( 'Please enter some content to post.', 'buddypress-media' ) ); wp_localice_script( 'rtmedia-main', 'rtmedia_empty_comment_msg', __( 'Empty comment is not allowed.', 'buddypress-media' ) );The
wp_localice_scriptfunction should only be called once and the strings should be passed as an array e.g.wp_localice_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-baccbone translations
The topic ‘Javascript String Translation Errors’ is closed to new replies.