wp china yes 与 elementor pro 共存时无法推送翻译的解决方案

正在查看 2 个帖子:1-1 (共 1 个帖子)
  • 作者
    帖子
  • 孙锡源
    • 文章数量: 704
    @ibadboy
    楼主

    该问题是 elementor pro 的编码 bug 引起的,实际上该 bug 不仅影响 china yes,也会同时影响其他会调用 pre_http_request 过滤器的插件。

    希望有渠道的小伙伴可以帮忙跟 elementor 的开发团队反馈一下。

    这里提供一个暂时的修复方案:

    编辑插件根目录的 elementor-pro.php 文件,将第 34 行和第 37 行由 return false; 修改为 return $pre;,示例:

    <?php
    /**
     * Plugin Name: Elementor Pro
     * Description: Elevate your designs and unlock the full power of Elementor. Gain access to dozens of Pro widgets and kits, Theme Builder, Pop Ups, Forms and WooCommerce building capabilities.
     * Plugin URI: https://elementor.com/
     * Author: Elementor.com
     * Version: 3.4.1
     * Elementor tested up to: 3.4.0
     * Author URI: https://elementor.com/
     *
     * Text Domain: elementor-pro
     */
    
    if ( ! defined( 'ABSPATH' ) ) {
           exit; // Exit if accessed directly.
    }
    
    update_option( 'elementor_pro_license_key', 'activated' );
    update_option( '_elementor_pro_license_data', [ 'timeout' => strtotime( '+12 hours', current_time( 'timestamp' ) ), 'value' => json_encode( [ 'license' => 'valid', 'expires' => '01.01.2030' ] ) ] );
    add_filter( 'elementor/connect/additional-connect-info', '__return_empty_array', 999 );
    
    add_action( 'init', function() {
           add_filter( 'pre_http_request', function( $pre, $parsed_args, $url ) {
                  if ( strpos( $url, 'my.elementor.com/api/v1/licenses' ) !== false ) {
                         return [
                                'response' => [ 'code' => 200, 'message' => '��' ],
                                'body'     => json_encode( [ 'license' => 'valid', 'expires' => '01.01.2030' ] )
                         ];
                  } elseif ( strpos( $url, 'my.elementor.com/api/connect/v1/library/get_template_content' ) !== false ) {
                         $response = wp_remote_get( "http://wordpressnull.org/elementor/templates/{$parsed_args['body']['id']}.json", [ 'sslverify' => false, 'timeout' => 25 ] );
                         if ( wp_remote_retrieve_response_code( $response ) == 200 ) {
                                return $response;
                         } else {
                                return $pre;
                         }
                  } else {
                         return $pre;
                  }
           }, 10, 3 );
    } );

     

    来自秦皇岛, 河北, 中国
    qwer1720346159
    • 文章数量: 46
    @qwer1720346159

    方案二:安装LitePress发行版

    来自南宁市, 广西, 中国
正在查看 2 个帖子:1-1 (共 1 个帖子)
  • 哎呀,回复话题必需登录。

话题信息