开发者 |
ipm-frommen
tfrommen |
---|---|
更新时间 | 2023年5月26日 05:00 |
PHP版本: | 3.5.0 及以上 |
WordPress版本: | 6.2.2 |
版权: | GPLv3 |
版权网址: | 版权信息 |
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.
`
/**
**
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
.
`
/**
**
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.
page-keys
folder to the /wp-content/plugins/
directory on your web server.get_page_by_key()
incorrectly returning current post.