Advertisement
mbis

Support translated pagination endpoints

Jan 2nd, 2020
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.48 KB | None | 0 0
  1. function pm_extra_pagination_endpoints($endpoints) {
  2.     $endpoints .= "|pagina|seite";
  3.  
  4.     return $endpoints;
  5. }
  6. add_filter('permalink_manager_endpoints', 'pm_extra_pagination_endpoints');
  7.  
  8. function pm_detect_pagination($uri_parts, $request_url) {
  9.     if(!empty($uri_parts['endpoint']) && in_array($uri_parts['endpoint'], array('pagina', 'seite'))) {
  10.         $uri_parts['endpoint'] = 'paged';
  11.     }
  12.  
  13.     return $uri_parts;
  14. }
  15. add_filter('permalink_manager_detect_uri', 'pm_detect_pagination', 99, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement