Advertisement
mbis

Detect RSS endpoint

May 30th, 2022
1,006
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_rss_endpoint($endpoints) {
  2.     return "{$endpoints}|rss";
  3. }
  4. add_filter('permalink_manager_endpoints', 'pm_extra_rss_endpoint', 9);
  5.  
  6. function pm_fix_rss_query($query, $old_query, $uri_parts, $pm_query, $content_type) {
  7.     if(isset($query['rss']) && isset($query['do_not_redirect'])) {
  8.         unset($query['rss']);
  9.         unset($query['do_not_redirect']);
  10.        
  11.         $query['feed'] = 'rss';
  12.     }
  13.  
  14.     return $query;
  15. }
  16. add_filter('permalink_manager_filter_query', 'pm_fix_rss_query', 3, 5);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement