https://github.com/norcross/extra-authors-redirect
Allow site owners to redirect the author archive pages.
https://github.com/norcross/extra-authors-redirect
wordpress wordpress-plugin wordpress-plugins
Last synced: 4 months ago
JSON representation
Allow site owners to redirect the author archive pages.
- Host: GitHub
- URL: https://github.com/norcross/extra-authors-redirect
- Owner: norcross
- License: mit
- Created: 2019-03-19T15:05:41.000Z (almost 7 years ago)
- Default Branch: main
- Last Pushed: 2024-12-05T18:05:22.000Z (about 1 year ago)
- Last Synced: 2025-04-02T07:15:25.365Z (10 months ago)
- Topics: wordpress, wordpress-plugin, wordpress-plugins
- Language: PHP
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Extra Authors Redirect
========================
## Contributors
* [Andrew Norcross](https://github.com/norcross)
## About
Adds a checkbox to redirect author profiles. Useful for sites that have occasional authors or user accounts not intended for display.
## Features
* a checkbox on each author profile
* a global setting for site-wide redirect
* filterable redirect location
* includes bbPress support
#### Does this affect posts / pages / admin / ???
No. this only affects people going to the /author/ template page on a site, and only affects those that have been marked to redirect or if the global settings is enabled.
#### Can I change where the redirect goes?
Yes. There is a filter to change the default behavior. Example:
~~~php
/**
* Change the URL that a redirected author profile goes to.
*
* @param string $location The current URL set.
* @param integer $user_id The individual user ID being redirected (if not global).
*
* @return string The new updated one.
*/
function set_custom_redirect_url( $location, $user_id ) {
return 'https://www.google.com';
}
add_filter( 'exar_redirect_url', 'set_custom_redirect_url', 10, 2 );
~~~
#### Can the redirect be something other than a 301?
Sure can. Change it to whatever you want. Example:
~~~php
/**
* Change the HTTP response code.
*
* @param integer $response_code The current HTTP response.
* @param integer $user_id The individual user ID being redirected (if not global).
*
* @return integer The new updated one.
*/
function set_custom_http_response( $response_code, $user_id ) {
return 302;
}
add_filter( 'exar_redirect_http_code', 'set_custom_http_response', 10, 2 );
~~~