Plugin Directory

Changeset 3313210


Ignore:
Timestamp:
06/17/2025 11:23:38 AM (10 months ago)
Author:
globaliser
Message:

Polylang fixes

Location:
globaliser
Files:
86 added
3 edited

Legend:

Unmodified
Added
Removed
  • globaliser/trunk/app/services/polylang-service.php

    r3309730 r3313210  
    1818        $this->set_plugin_info();
    1919        $this->filter('rest_post_dispatch', 'restapi_totalpages', 10, 3);
     20        $this->filter('rest_post_query', 'filter_rest_query_by_lang', 10, 2);
     21        $this->on('init', "add_language_support_restapi");
     22       
     23
     24
     25   
    2026    }
    2127    private function set_plugin_info()
     
    6874        return $response;
    6975    }
     76
     77    public function add_language_support_restapi(){
     78
     79        foreach (get_post_types(['public' => true], 'names') as $post_type) {
     80             $this->filter("rest_{$post_type}_query", 'filter_rest_query_by_lang', 10, 2);
     81        }
     82
     83    }
     84
     85
     86    /**
     87     * Filter REST API queries by Polylang language.
     88     */
     89    function filter_rest_query_by_lang($args, $request) {
     90        if (!empty($request['lang']) && taxonomy_exists('language')) {
     91            $lang = sanitize_text_field($request['lang']);
     92            $args['tax_query'][] = [
     93                'taxonomy' => 'language',
     94                'field'    => 'slug',
     95                'terms'    => $lang,
     96            ];
     97        }
     98        return $args;
     99    }
    70100}
  • globaliser/trunk/globaliser.php

    r3309730 r3313210  
    44   Plugin URI: https://www.globaliser.com/wordpress-hosting/
    55   Description:  This plugin enables Globaliser Cloud Speed, Security, and Reliability features for WordPress sites. It is intended for Globaliser clients only.
    6    Version: 0.9.8
     6   Version: 0.9.9
    77   Author: Globaliser, Inc.
    88   Author URI: https://www.globaliser.com
  • globaliser/trunk/readme.txt

    r3309730 r3313210  
    55License: GPLv2 or later
    66Tested up to: 6.8.1
    7 Stable tag: 0.9.8
     7Stable tag: 0.9.9
    88Requires PHP: 8.1
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2727
    2828== Changelog ==
     29
     30= 0.9.9 =
     31* Bug fix sites using Polylang Plugin.
    2932
    3033= 0.9.8 =
Note: See TracChangeset for help on using the changeset viewer.