WordPress plugin intelligence profile

Page Keys

Register page keys, assign WordPress pages to them, and access each of these pages by its individual key.

WP PlugIndex snapshot

Current directory snapshot

Tested up to WordPress 6.9
Current version1.3.4
WordPress coverageTested up to WordPress 6.9
Minimum stackWP 3.5.0 · PHP —
Directory statusactive
Last directory update7 Jan 20269mo ago
Active installations60Adoption metric — not a quality score
WordPress.org ratingNo WordPress.org ratings yet
Official packageDirect from WordPress.org

Repository metrics are context, not quality scores. Active installations measure adoption and can strongly reflect a plugin’s age and historical popularity. Ratings, recent updates and “Tested up to” metadata also do not guarantee modern code, error-free operation, security, feature completeness or suitability for a particular site. Why active installs don’t tell the whole story →

WP PlugIndex currently records Page Keys version 1.3.4 as active, updated 9mo ago and tested up to WordPress 6.9.

Overview

About this plugin

Register page keys, assign WordPress pages to them, and access each of these pages by its individual key.

Have you ever wanted to access a specific page from inside a template file? Of course, you could query it by its title. But what if someone wanted to rename the page?

Okay, so we choose the slug. But maybe that someone also thought editing the slug as well to make it fit the new title was a very good idea. Yes, I know, it is not.

But that someone either didn’t know, or didn’t care. Okay, so let’s use the page ID. Oh, wait, now that someone, by mistake, permanently deleted that page.

After having visited the frontend that someone created a new page, with the exact same title and the exact same slug as the original page. But that damn page still won’t show.

This is exactly when Page Keys kicks in.

Usage

What this plugin is all about is providing a means to accessing specific pages by unique and therefore individual keys. And doing this is quite simple. On the Page Keys admin page, you can add as many unique page keys as you like.

For each of these page keys, you then select a (published) page. Hit the Save Changes button, and you’re done already.

Suppose you now want to access a specific page in one of your theme’s template file. After having defined a page key and having assigned a page to it, you can get the according WP_Post object by calling get_page_by_key( $key ). In the rare case where you already have a function of that name defined within the global namespace, you would have to set up such a function by yourself.

php file of this plugin.

Filters

In order to customize certain aspects of the plugin, it provides you with several filters. For each of these, a short description as well as a code example on how to alter the default behavior is given below. php file or your customization plugin, or to some other appropriate place.

edit_page_keys_capability

Editing the page keys is restricted to a certain capability, which is by default edit_published_pages. , changing its status to draft ), implicitly is able to compromise any page key mapped to the page.

/** * Filter the capability required to edit the page keys. * * @param string $capability Capability required to edit the page keys. */ add_filter( 'edit_page_keys_capability', function() {

return 'manage_options'; } );

list_page_keys_capability

Accessing the plugin’s settings page is restricted, too. In order to distinguish between users who are only allowed to see the existing page keys as well as their respective page, and users, who are able to edit page keys, there are two individual capabilities. The default for accessing the settings page is edit_pages.

/** * Filter the capability required to list the page keys. * * @param string $capability Capability required to list the page keys. */ add_filter( 'list_page_keys_capability', function() {

return 'read'; } );

page_keys_show_admin_notice

Depending on how exactly you are working with the plugin, the admin notice informing you about page keys that don’t have a page assigned might be more annoying than helping. Gladly, there is a filter to turn this off.

add_filter( 'page_keys_show_admin_notice', '__return_false' );

Contribution

To contribute to this plugin, please see its GitHub repository.

If you have a feature request, or if you have developed the feature already, please feel free to use the Issues and/or Pull Requests section.

Of course, you can also provide me with translations if you would like to use the plugin in another not yet included language.

WordPress.org metadata

Plugin tags

Topics listed for this plugin in the WordPress.org directory.

  • keys
  • page
  • pages
Compatibility & maintenance

Compatibility & maintenance

Tested up to WordPress 6.9

Not yet marked as tested with WordPress 7.1. WordPress.org currently lists Tested up to 6.9.

Current WordPress releaseWordPress 7.1
WordPress.org Tested up to6.9
Minimum requirementsWordPress 3.5.0 · PHP not listed
Update activity7 Jan 20269mo ago

“Tested up to” is directory metadata supplied by the plugin author. WP PlugIndex does not turn an older declaration into a claim that the plugin is incompatible.

Changes recorded by WP PlugIndex

Recent tracked changes

No tracked version or compatibility changes have been recorded by WP PlugIndex yet.

Tracking & source

WP PlugIndex tracks public WordPress.org directory metadata and records selected version, compatibility and availability changes as they are detected.

Plugin watchlist

Watch this plugin

Sign in to your WP PlugIndex account or create a free account. Free accounts can watch up to 5 plugins and see what changed.

Watch limit

Watchlist limit reached

You have reached your current active watch limit.