Page Keys

Page Keys

Wordpress plugin

Install on Wordpress

App Details

Register page keys, assign actual 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. In principle, this is just a copy of what you can find in the functions.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. Just put the according code snippet in your theme’s functions.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. The reason for this choice lies with the fact that user, who is capable of editing a published page (e.g., 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.

Pricing

Starting from $0 per month.

Check Out the All in One Reviews Widget

By Common Ninja

All in One ReviewsTry For Free!

App Info

Rating

Reviewers

No reviews

Tags

keys
page
pages

Developed By

Thorsten Frommen

Quick & Easy

Find the Best Wordpress plugins for you

Common Ninja has a large selection of powerful Wordpress plugins that are easy to use, fully customizable, mobile-friendly and rich with features — so be sure to check them out!

Testimonial

Testimonial plugins for Wordpress

Galleries

Galleries plugins for Wordpress

SEO

SEO plugins for Wordpress

Contact Form

Contact Form plugins for Wordpress

Forms

Forms plugins for Wordpress

Social Feeds

Social Feeds plugins for Wordpress

Social Sharing

Social Sharing plugins for Wordpress

Events Calendar

Events Calendar plugins for Wordpress

Sliders

Sliders plugins for Wordpress

Analytics

Analytics plugins for Wordpress

Reviews

Reviews plugins for Wordpress

Comments

Comments plugins for Wordpress

Portfolio

Portfolio plugins for Wordpress

Maps

Maps plugins for Wordpress

Security

Security plugins for Wordpress

Translation

Translation plugins for Wordpress

Ads

Ads plugins for Wordpress

Video Player

Video Player plugins for Wordpress

Music Player

Music Player plugins for Wordpress

Backup

Backup plugins for Wordpress

Privacy

Privacy plugins for Wordpress

Optimize

Optimize plugins for Wordpress

Chat

Chat plugins for Wordpress

Countdown

Countdown plugins for Wordpress

Email Marketing

Email Marketing plugins for Wordpress

Tabs

Tabs plugins for Wordpress

Membership

Membership plugins for Wordpress

popup

popup plugins for Wordpress

SiteMap

SiteMap plugins for Wordpress

Payment

Payment plugins for Wordpress

Coming Soon

Coming Soon plugins for Wordpress

Ecommerce

Ecommerce plugins for Wordpress

Customer Support

Customer Support plugins for Wordpress

Inventory

Inventory plugins for Wordpress

Video Player

Video Player plugins for Wordpress

Testimonials

Testimonials plugins for Wordpress

Tabs

Tabs plugins for Wordpress

Social Sharing

Social Sharing plugins for Wordpress

Social Feeds

Social Feeds plugins for Wordpress

Slider

Slider plugins for Wordpress

Reviews

Reviews plugins for Wordpress

Portfolio

Portfolio plugins for Wordpress

Membership

Membership plugins for Wordpress

Forms

Forms plugins for Wordpress

Events Calendar

Events Calendar plugins for Wordpress

Contact

Contact plugins for Wordpress

Comments

Comments plugins for Wordpress

Analytics

Analytics plugins for Wordpress

Common Ninja Apps

Some of the best Common Ninja plugins for Wordpress

Browse our extensive collection of compatible plugins, and easily embed them on any website, blog, online store, e-commerce platform, or site builder.

All in One Reviews for Wordpress logo

All in One Reviews

Display and manage customer reviews from multiple platforms in one place to build trust and highlight brand credibility.

Progress Circles for Wordpress logo

Progress Circles

Show progress with animated progress circles that visualize goals, display achievements, and keep visitors engaged.

Vimeo Carousel for Wordpress logo

Vimeo Carousel

Show Vimeo videos with a Vimeo carousel that displays clips in a smooth, flexible layout to boost visibility and engagement.

Diagrams for Wordpress logo

Diagrams

Create interactive diagrams with a diagrams widget that lets you build and customize flow charts, improve clarity, and help visitors understand complex ideas easily.

LinkedIn Feed Carousel for Wordpress logo

LinkedIn Feed Carousel

Show LinkedIn posts with a LinkedIn feed carousel that auto updates, presents content in a smooth layout, and keeps visitors engaged.

Stop Motion Player for Wordpress logo

Stop Motion Player

Create engaging stop motion displays with a stop motion player that turns image sequences into interactive animations to boost creativity and visitor engagement.

March Madness Bracket Maker for Wordpress logo

March Madness Bracket Maker

Create interactive March Madness brackets where users can make predictions, track tournament progress, and compete with others throughout every round.

Accordion for Wordpress logo

Accordion

Add collapsible content sections to your site to organize information and help users navigate content more efficiently.

Live Weather Forecast for Wordpress logo

Live Weather Forecast

Use a live weather forecast widget to show current conditions and upcoming predictions, giving visitors real time local weather updates for better planning.

Restaurant Menu List for Wordpress logo

Restaurant Menu List

Create a clear restaurant menu list that helps visitors explore dishes easily, understand key details, and make confident ordering decisions that support conversions.

Threads Feed for Wordpress logo

Threads Feed

Show Threads posts in a live feed that keeps content fresh, builds social proof, and helps visitors engage on your site.

Social Media Links for Wordpress logo

Social Media Links

Use social media links with sticky buttons that keep your profiles visible, boost engagement, and help promote your content more effectively across your site.

Discover Apps By Platform

Discover the best apps for your website

WordPress
Wix
Shopify
Weebly
Webflow
Joomla
PrestaShop
Shift4Shop
WebsiteX5
MODX
Opencart
NopCommerce

Common Ninja Search Engine

The Common Ninja Search Engine platform helps website builders find the best site widgets, apps, plugins, tools, add-ons, and extensions! Compatible with all major website building platforms - big or small - and updated regularly, our Search Engine tool provides you with the business tools your site needs!

Multiple platforms