Plugin / Arha Routes
Description
Description
WordPress plugin that helps to serve content through REST routes and gives
customizability to developers through filters.
Available Routes
/wp-json/arha/v1/post?post_type=POST_TYPE&slug=SLUG
/wp-json/arha/v1/page?path=PATH
/wp-json/arha/v1/options
/wp-json/arha/v1/archive?post_type=POST_TYPE&posts_per_page=POSTS_PER_PAGE&paged=PAGED&orderby=ORDERBY&order=ORDER(&meta_key=META_KEY)
Filters
-
To exclude querying specific post types from
post
– andarchive
-routes, you
can use following filters:add_filter('arha_routes/archive_excluded_post_types', 'exclude_post_types');
add_filter('arha_routes/post_excluded_post_types', 'exclude_post_types');
function exclude_post_types($excluded_post_types) {
$excluded_post_types = ['post'];
return $excluded_post_types;
} -
To format
post
-route’s post before it’s served to client, usearha_routes/format_post
-filteradd_filter('arha_routes/format_post', 'format_post');
function format_post($post) {
return $post;
} -
To format
page
-route’s page before it’s served to client, usearha_routes/format_page
-filteradd_filter('arha_routes/format_page', 'format_page');
function format_page($page) {
return $page;
} -
To format
archive
-route’s posts before they are served to client, usearha_routes/format_archive_post
-filteradd_filter('arha_routes/format_archive_post', 'format_archive_post');
function format_archive_post($post) {
return $post;
} -
options
-route returns empty result by default. To add content to it, usearha_routes/format_options
-filteradd_filter('arha_routes/format_options', 'format_options');
function format_options($options) {
return $options;
}
SearchWP
Arha Routes supports SearchWP-plugin, which lets WP users to make keyword search engine for their content.
Activating SearchWP-plugin adds optional keyword-search functionality to archive
-route. This is done by adding s=KEYWORD
to the route
– Example: /wp-json/arha/v1/archive?post_type=products&posts_per_page=10&paged=1&orderby=date&order=ASC&s=monitor
Polylang
Arha Routes supports Polylang-plugin, which allows users to create content in multiple languages.
Activating Polylang changes how endpoints work:
- all routes require additional
lang
-param- Example:
/wp-json/arha/v1/archive?post_type=products&posts_per_page=10&paged=1&orderby=date&order=ASC&lang=en
- Example:
page
-route doesn’t support language prefix in path- Example: Permalink
/zh/info
, use like this/wp-json/arha/v1/page?path=/info&lang=zh
- Example: Permalink
/en/info/test
, use like this/wp-json/arha/v1/page?path=/info/test&lang=zh
- Example: Permalink
options
-route passeslang
-param forward toarha_routes/format_options
-filter- Developer can then set Polylang’s language model to this language with
ArhaHelpers::set_polylang_curlang($lang)
if needed.add_filter('arha_routes/format_options', 'format_options', 10, 2);
function format_options($options, $lang) {
return $options;
}
- Developer can then set Polylang’s language model to this language with
Polylang + SearchWP
In order to make these two plugins work together, you need to add extra plugin to WP installation.
https://searchwp.com/extensions/polylang-integration/
Ratings
Rating breakdown
Details Information
Version
First Released
Total Downloads
Wordpress Version
Tested up to:
Require PHP Version:
Tags
Contributors
Languages
The plugin hasn't been transalated in any language other than English.
DIRECTORY DISCLAIMER
The information provided in this THEME/PLUGIN DIRECTORY is made available for information purposes only, and intended to serve as a resource to enable visitors to select a relevant theme or plugin. wpSocket gives no warranty of any kind, express or implied with regard to the information, including without limitation any warranty that the particular theme or plugin that you select is qualified on your situation.
The information in the individual theme or plugin displayed in the Directory is provided by the owners and contributors themselves. wpSocket gives no warranty as to the accuracy of the information and will not be liable to you for any loss or damage suffered by you as a consequence of your reliance on the information.
Links to respective sites are offered to assist in accessing additional information. The links may be outdated or broken. Connect to outside sites at your own risk. The Theme/Plugin Directory does not endorse the content or accuracy of any listing or external website.
While information is made available, no guarantee is given that the details provided are correct, complete or up-to-date.
wpSocket is not related to the theme or plugin, and also not responsible and expressly disclaims all liability for, damages of any kind, arising out of the use, reference to, or reliance on, any information or business listed throughout our site.