Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Wordpress / routing pluginu
qbas-s
post 11.12.2017, 23:48:26
Post #1





Grupa: Zarejestrowani
Postów: 304
Pomógł: 1
Dołączył: 28.06.2009

Ostrzeżenie: (0%)
-----


W jaki sposób dodaje się routing pluginu?
Wywołania w startowym pliku pluginu czegoś takiego nie działa

  1.  
  2. add_filter('query_vars', 'custom_query_vars');
  3. add_action('init', 'my_plugin_url');
  4.  
  5. function custom_query_vars($vars){
  6. $vars[] = 'api_action';
  7. return $vars;
  8. }
  9.  
  10. function my_plugin_url() {
  11.  
  12. add_rewrite_rule(
  13. '^api/(\w)?',
  14. 'index.php?api_action=$matches[1]',
  15. 'top'
  16. );
  17.  
  18. }


Ten post edytował qbas-s 11.12.2017, 23:48:47
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 28.03.2024 - 11:34