🔥 Black Friday Sale: Get 65% OFF Any PageForge Pro Plan! Use code BF65 Claim Offer →
Konto Get it free
WP Router icon
Möglicherweise aufgegeben Tested up to 3.4.2 #1 in callback functions

WP Router

WordPress’s rewrite rules and query variables provide a powerful system for mapping URL strings to collections of posts. Every request is parsed into query variables and turned into a SQL query via $wp_query->query().

Aktive Installationen800+100+ Stufe
Downloads · 30d386▲ +13.9% vs prev. 30d
Wertung3.7/53 Bewertungen
Gesundheits-Score30/100In Gefahr
Downloads aller Zeiten20KSince May 2011
Unterstützung gelöst—Keine aktuellen Threads
erfordertWP 3.0PHP ANY
Downloads · 7d140▲ +75% week over week
Unser Urteil

Betrachten Sie eine Alternative

WP Router shows warning signs in 2026 — compare the alternatives below before installing. It runs on 800+ sites, is rated 3.7/5 and was last updated 14 years ago, and scores 30/100 on our health check.

  • Small user base (800+ active installs)
  • Bisher sehr wenige Bewertungen
  • No update in 14 years
  • Only tested up to WordPress 3.4 (latest is 7.1)

Tägliche Downloads

112233Sep 2Oct 16Nov 30
Gestern45
Täglicher Durchschnitt (1 Jahr)11
Spitzentag56Apr 13, 2026
Letzte 12 Monate4.1K

Download-Spitzen folgen normalerweise einer neuen Version - jede Website, die automatisch aktualisiert wird, gilt als Download.

Ranglisten

Where WP Router stands today

WordPress.org Ranglisten suchen

Live-Position in der Plugin-Suche, Top 100
StichwortPositionKonkurrierende PluginsKategorie
callback functions >100 1,446 Best callback functions plugins →
URL mapping >100 1,821 Best URL mapping plugins →

Versionsübernahme

Anteil aktiver Sites pro Release.

  • 0.5100.0%

Bewertungsaufschlüsselung

★★★★★★★★★★ 3.7 from 3 reviews

  • 5★66.7%
  • 4★0.00%
  • 3★0.00%
  • 2★0.00%
  • 1★33.3%

About WP Router

From the official readme · v0.5

Beschreibung

WordPress’s rewrite rules and query variables provide a powerful system
for mapping URL strings to collections of posts. Every request is parsed
into query variables and turned into a SQL query via $wp_query->query().

Sometimes, though, you don’t want to display a list of posts. You just want
a URL to map to a callback function, with the output displayed in place of
posts in whatever theme you happen to be using.

That’s where WP Router comes in. It handles all the messy bits of registering
post types, query variables, rewrite rules, etc., and lets you write code to
do what you want it to do. One function call is all it takes to map a
URL to your designated callback function and display the return value in the page.

Created by Flightless

Verwendung

Creating Routes

  • Your plugin should hook into the wp_router_generate_routes action.
    The callback should take one argument, a WP_Router object.
  • Register a route and its callback using WP_Router::add_route( $id, $args )

    • $id is a unique string your plugin should use to identify the route
    • $args is an associative array, that sets the following properties for your route.
      Any omitted argument will use the default value.

      • path (required) – A regular expression to match against the request path.
        This corresponds to the array key you would use when creating rewrite rules for WordPress.

      • query_vars – An associative array, with the keys being query vars, and the
        values being explicit strings or integers corresponding to matches in the path regexp.
        Any query variables included here will be automatically registered.

      • title – The title of the page.

      • title_callback – A callback to use for dynamically generating the title.
        Defaults to __(). If NULL, the title argument will be used as-is. if
        page_callback or access_callback returns FALSE, title_callback will not be called.

        title_callback can be either a single callback function or an array specifying
        

        callback functions for specific HTTP methods (e.g., GET, POST, PUT, DELETE, etc.).
        If the latter, the default key will be used if no other keys match the current
        request method.

      • title_arguments – An array of query variables whose values will be passed
        as arguments to title_callback. Defaults to the value of title. If an argument
        is not a registered query variable, it will be passed as-is.

      • page_callback (required) – A callback to use for dynamically generating the
        contents of the page. The callback should either echo or return the contents of
        the page (if both, the returned value will be appended to the echoed value). If
        FALSE is returned, nothing will be output, and control of the page contents will
        be handed back to WordPress. The callback will be called during the parse_request
        phase of WordPress’s page load. If access_callback returns FALSE, page_callback
        will not be called.

        page_callback can be either a single callback function or an array specifying
        

        callback functions for specific HTTP methods (e.g., GET, POST, PUT, DELETE, etc.).
        If the latter, the default key will be used if no other keys match the current
        request method.

      • page_arguments – An array of query variables whose values will be passed as
        arguments to page_callback. If an argument is not a registered query variable,
        it will be passed as-is.

      • access_callback – A callback to determine if the user has permission to access
        this page. If access_arguments is provided, default is current_user_can, otherwise
        default is TRUE. If the callback returns FALSE, anonymous users are redirected to
        the login page, authenticated users get a 403 error.

        access_callback can be either a single callback function or an array specifying
        

        callback functions for specific HTTP methods (e.g., GET, POST, PUT, DELETE, etc.).
        If the latter, the default key will be used if no other keys match the current
        request method.

      • access_arguments – An array of query variables whose values will be passed
        as arguments to access_callback. If an argument is not a registered query variable,
        it will be passed as-is.

      • template – An array of templates that can be used to display the page. If a path
        is absolute, it will be used as-is; relative paths allow for overrides by the theme.
        The string $id will be replaced with the ID of the route. If no template is found,
        fallback templates are (in this order): route-$id.php, route.php, page-$id.php,
        page.php, index.php. If FALSE is given instead of an array, the page contents will
        be printed before calling exit() (you can also accomplish this by printing your output
        and exiting directly from your callback function).

Example:
$router->add_route(‘wp-router-sample’, array(
‘path’ => ‘^wp_router/(.*?)$’,
‘query_vars’ => array(
‘sample_argument’ => 1,
),
‘page_callback’ => array(get_class(), ‘sample_callback’),
‘page_arguments’ => array(‘sample_argument’),
‘access_callback’ => TRUE,
‘title’ => ‘WP Router Sample Page’,
‘template’ => array(‘sample-page.php’, dirname(FILE).DIRECTORY_SEPARATOR.’sample-page.php’)
));

In this example, the path http://example.com/wp_router/my_sample_path/ will call
the function sample_callback in the calling class. The value of the sample_argument
query variable, in this case “my_sample_path”, will be provided as the first and only
argument to the callback function. If the file sample-page.php is found in the theme,
it will be used as the template, otherwise sample-page.php in your plugin directory will
be used (if that’s not found either, fall back to route-wp-router-sample.php, etc.).

Editing Routes

  • You can hook into the wp_router_alter_routes action to modify routes created by other plugins. The callback should take one argument, a WP_Router object.

Public API Functions

Creating or changing routes should always occur in the context of the wp_router_generate_routes or wp_router_alter_routes actions, using the WP_Router object supplied to your callback function.

  • WP_Router::edit_route( string $id, array $changes ) – update each
    property given in $changes for the route with the given ID. Any properties
    not given in $changes will be left unaltered.
  • WP_Router::remove_route( string $id ) – delete the route with the given ID
  • WP_Router::get_route( string $id ) – get the WP_Route object for the given ID
  • WP_Router::get_url( string $id, array $arguments ) – get the URL to reach the route with the given ID, with the given query variables and their values
  • WP_Route::get( string $property ) – get the value of the specified property for
    the WP_Route instance

Installation

  1. Laden Sie das Plugin herunter und entpacken Sie es
  2. Laden Sie den Ordner WP-Router in das /wp-content/plugins/-Verzeichnis hoch
  3. Aktivieren Sie das Plugin über das „Plugins“-Menü in WordPress
  4. You should see the sample page at http://example.org/wp_router/sample/. Apart from that, there is no public UI for this plugin. You will not see any changes unless the plugin’s API is called by another active plugin.

Änderungsprotokoll

0.5

  • Filter get_permalink on router pages to point to the requested URI
  • Filter post meta for the placeholder page when on a router page to provide a title to WP SEO
  • Added wp_router_placeholder_postmeta filter for adding additional meta to the placeholder page

0.4

  • Prevent redirect from route pages with the “page” or “paged” query arg

0.3.3

  • Prevent redirect from all route pages when %category% is in the permastruct
  • Redirect placeholder page to the blog front page
  • Fix usage of translation functions

0.3.2

  • Make $arguments param optional for WP_Router::get_url() and WP_Router::url()

0.3.1

  • Added WP_Router::get_url()
  • Added WP_Route::url()

0.3

  • Added FALSE option to template parameter to indicate immediate exit()
  • Added option to specify different callback functions depending on the HTTP request method
  • Verified compatibility with WordPress 3.0
  • Added WP_Router::get_url() function

Vollständiges Änderungsprotokoll auf WordPress.org →

Für Entwickler

Ist das dein Plugin? Zeigen Sie die Zahlen.

Fügen Sie Ihrer Website, Docs oder GitHub Readme ein Live-Badge hinzu. Es wird von selbst aktualisiert - kein Konto erforderlich.

Aktiv installiert Badge Bewertungsabzeichen Gesundheits-Score-Abzeichen

Fragen und Antworten

WP Router: quick answers

Gerade Antworten, gezogen von Live WordPress.org Daten.

Quelle: WordPress.org

Is WP Router free?

Yes. WP Router is free to download and use from the official WordPress.org plugin directory.

Is WP Router safe to use in 2026?

WP Router shows warning signs in 2026 — compare the alternatives below before installing. It runs on 800+ sites, is rated 3.7/5 and was last updated 14 years ago, and scores 30/100 on our health check.

How many websites use WP Router?

WP Router is active on 800+ WordPress websites and has been downloaded 20,002 times since it launched in May 2011. It was downloaded 386 times in the last 30 days.

Does WP Router work with WordPress 7.1?

WP Router is officially tested up to WordPress 3.4.2, while the latest release is 7.1.5. It may still work, but try it on a staging site first.

When was WP Router last updated?

The latest version, 0.5, was released on August 6, 2012 (14 years ago).

Who makes WP Router?

WP Router is developed and maintained by Jonathan Brinley.

Angetrieben von PageForge

Eine Vorlage und eine Tabelle. Eine echte Seite für jede Suche.

PageForge Verwandelt jede Zeile eines CSV in eine WordPress-Seite mit eigenem Titel, URL, SEO Felder und Schema entworfen. Kostenlos auf WordPress.org.

  • CSV und XLSX, plus Google Sheets auf Beruf und Unternehmen
  • seinen eigenen Titel, URL, SEO Felder und Schema für jede Seite
  • Arbeitet mit dem Blockeditor, Elementor, Divi und Avada
  • Kostenlos auf WordPress.org, keine Kreditkarte

↑↓ bewegen↵ öffnen