gnt-wordpress

已建立論壇回覆

正在檢視 10 個帖子:1-10 (共 25 個帖子)
  • 作者
    帖子
  • gnt-wordpress
    參與者
    • 文章數量: 49
    @gnt-wordpress
    樓主

    @feibisi 能否指導一下,將檔案分離到一個獨立的站點之後,下一步將檔案關聯到 oss 中得指導?

    目前我們的方案是,在一個多站點環境中,使用 NGINX 透過檔案型別判斷,將單站點的檔案請求 /wp-content/upload/site/[site-id]/*   下的檔案,轉發到一個固定的配置 CDN 的域名  /data-upload/[site-id]/*  中進行請求。

    優點:當然是簡單

    目前隨著站點增多,檔案越來越多,目前有點兒困惑在思考接下來要不要完全獨立到 OSS 上的問題。

    1. 維護起來還是相比稍微麻煩。

    2. 這個轉發僅僅是前端頁面的內容的轉發,後端的檔案請求還是依賴於原站點的域名請求,對於資源來說也是一種浪費。

    3. 對於嵌入到 css 中得如 background-image 的檔案,完全無法實現預設的功能。

    4. 可能對於下一步的伺服器維護,有一定的困擾,比如如果要加負載均衡的話。

    基於此,再思考要不要將當前的方案,轉為完全的 oss 支援上去。

    由於站點比較多,容錯空間比較小,希望獲得一點兒指導!

    gnt-wordpress
    參與者
    • 文章數量: 49
    @gnt-wordpress
    樓主

    @feibisi 請問下大神,這個 cookie 共享的方案,現在咋樣了?

     

    gnt-wordpress
    參與者
    • 文章數量: 49
    @gnt-wordpress
    樓主

    感謝 @feibisi  經過尋找測試,最終實現的 custom query 如下

     

    add_action( ‘elementor/query/get_blog_post_xiangmu’, function( $query ) {
    // 切換到 318 站點
    switch_to_blog(318);
    $query->set( ‘post_type’, [ ‘post’ ] );
    $query->set( ‘category__in’, array( 12 ) );
    // 恢復到原始站點
    add_action(‘loop_end’, function() {
    restore_current_blog();
    });
    });

    add_action(‘loop_end’, function()  最後這個是必須的不然會導致死迴圈,造成站點 504 。

    測試在 elementor 元件中  post 可以用,但是 loop 的 post 模組無效!

    gnt-wordpress
    參與者
    • 文章數量: 49
    @gnt-wordpress
    樓主

    好的這個外掛,測試一下,重定向外掛,主要問題就是對於多語言的支援未知,而且絕大部分支援很差,比如一個分類重定向到一個頁面,那麼在主語言英文中功能正常,切換到德語,那麼大機率要麼不生效,要麼還是重定向到了英文頁面。我們的應用場景來說,語言比較多 (10 來種) 就意味著如果是基於 URL 的重定向,那麼是一個比較大的工程。目前透過 ID 現了重定向觀察一段時間再說!

    function custom_category_redirect() {

    $tag_id = get_queried_object_id();
    if($tag_id){
    if ( $tag_id == 15 || $tag_id == 21 || $tag_id == 22 || $tag_id == 23) {
    wp_redirect( get_permalink( 40 ) );
    exit;
    }
    if ( $tag_id == 24) {
    wp_redirect( get_permalink( 1942 ) );
    exit;
    }
    if ( $tag_id == 25) {
    wp_redirect( get_permalink( 2497 ) );
    exit;
    }
    if ( $tag_id == 36) {
    wp_redirect( get_permalink( 2505 ) );
    exit;
    }
    if ( $tag_id == 35) {
    wp_redirect( get_permalink( 2504 ) );
    exit;
    }
    if ( $tag_id == 42) {
    wp_redirect( get_permalink( 2503 ) );
    exit;
    }
    if ( $tag_id == 41) {
    wp_redirect( get_permalink( 2502 ) );
    exit;
    }
    if ( $tag_id == 50) {
    wp_redirect( get_permalink( 2501 ) );
    exit;
    }
    }

    }
    add_action( ‘template_redirect’, ‘custom_category_redirect’ );

    gnt-wordpress
    參與者
    • 文章數量: 49
    @gnt-wordpress
    樓主

    @feibisi 呼叫一下大神

    gnt-wordpress
    參與者
    • 文章數量: 49
    @gnt-wordpress
    樓主

    極其低的頻率會出現這個問題

    1693789228669WX20230904-090042

     

    Redis 平時又是正常的

    gnt-wordpress
    參與者
    • 文章數量: 49
    @gnt-wordpress
    樓主

    我是這樣來實現的
    function replace_recaptcha_url() {
    // 替換 reCAPTCHA URL
    function replace_recaptcha_script($url) {
    return str_replace(‘https://www.google.com/recaptcha/’, ‘https://recaptcha.net/recaptcha/’, $url);
    }
    add_filter(‘script_loader_src’, ‘replace_recaptcha_script’);
    }
    add_action(‘wp_enqueue_scripts’, ‘replace_recaptcha_url’);

    gnt-wordpress
    參與者
    • 文章數量: 49
    @gnt-wordpress
    樓主

    都沒有找到如上的設定項啊!!

    gnt-wordpress
    參與者
    • 文章數量: 49
    @gnt-wordpress
    樓主

    請問一下,多站點系統,配置阿里雲 OSS ,是需要每個站點都啟用並配置外掛麼,好像這些外掛並不支援多站點配置?

    gnt-wordpress
    參與者
    • 文章數量: 49
    @gnt-wordpress
    樓主

    不好意思,,我沒找到 第一個 AMP for Elementor 的外掛,方便發分享一下連線麼。第四個好像是第二個的拓展外掛!

正在檢視 10 個帖子:1-10 (共 25 個帖子)