-
-
Save girvo/4fa9ea0ab3c8f2453c3f to your computer and use it in GitHub Desktop.
Query vars for WP-API, trying to understand how everything works
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = [ | |
'offset', // (int) - number of post to displace or pass over. Warning: Setting the offset parameter overrides/ignores the paged parameter and breaks pagination (Click here for a workaround). The 'offset' parameter is ignored when 'posts_per_page'=>-1 (show all posts) is used. | |
'posts_per_archive_page', // (int) - number of posts to show per page - on archive pages only. Over-rides posts_per_page and showposts on pages where is_archive() or is_search() would be true. | |
// 'showposts', // <replaced by posts_per_page> | |
'nopaging', // (boolean) - show all posts or use pagination. Default value is 'false', use paging. | |
'post_type', // (string / array) - use post types. Retrieves posts by Post Types, default value is 'post'. | |
'post_status', // (string / array) - use post status. Retrieves posts by Post Status. Default value is 'publish', but if the user is logged in, 'private' is added. | |
'category__in', // (array) - use category id. | |
'category__not_in', // (array) - use category id. | |
'category__and', // (array) - use category id. | |
'tag__in', // (array) - use tag ids. | |
'tag__not_in', // (array) - use tag ids. | |
'tag__and', // (array) - use tag ids. | |
'tag_slug__in', // (array) - use tag slugs. | |
'tag_slug__and', // (array) - use tag slugs. | |
'tag_id', // (int) - use tag id. | |
'post_mime_type', // | |
'perm', // (string) - User permission. | |
'comments_per_page', // | |
'post__in', // (array) - use post ids. Specify posts to retrieve. | |
'post__not_in', // (array) - use post ids. Specify post NOT to retrieve. | |
'post_parent', // (int) - use page id. Return just the child Pages. | |
'post_parent__in', // (array) - use post ids. Specify posts whose parent is in an array. | |
'post_parent__not_in' // (array) - use post ids. Specify posts whose parent is not in an array. | |
].sort(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = [ | |
'm', // (int) - YearMonth (For e.g.: 201307). | |
'p', // (int) - use post id. | |
'w', // (int) - Week of the year (from 0 to 53). Uses MySQL WEEK command. The mode is dependent on the "start_of_week" option. | |
'cat', // (int) - use category id. | |
's', // (string) - Search keyword. | |
'order', // (string) - Designates the ascending or descending order of the 'orderby' parameter. Defaults to 'DESC'. | |
'orderby', // (string) - Sort retrieved posts by parameter. Defaults to 'date'. One or more options can be passed. | |
'year', // (int) - 4 digit year (e.g. 2011). | |
'monthnum', // (int) - Month number (from 1 to 12). | |
'day', // (int) - Week of the year (from 0 to 53). | |
'hour', // (int) - Hour (from 0 to 23). | |
'minute', // (int) - Minute (from 0 to 60). | |
'second', // (int) - Second (0 to 60). | |
'name', // (string) - use post slug. | |
'category_name', // (string) - use category slug (NOT name). | |
'tag', // (string) - use tag slug. (for multiple, 'filter[tag]=slug,slug' or 'filter[tag]=slug+slug') | |
'author', // (int) - use author id. | |
'author_name', // (string) - use 'user_nicename' (NOT name). | |
'pagename', // (string) - use page slug. | |
'page_id', // (int) - use page id. | |
'error', // (string) - error code to show a page for, e.g. ?error=404 | |
'taxonomy', // (string) - Taxonomy. | |
'post_type', // (string / array) - use post types. Retrieves posts by Post Types, default value is 'post'. If 'tax_query' is set for a query, the default value becomes 'any' 'more', // | |
// The following properties should be set directly, not within "filter[]" | |
'page', //*(int) - number of page for a static front page. Show the posts that would normally show up just on page X of a Static Front Page. | |
// The following properties DO NOT seem to work as filter[]s OR regular query params | |
'paged', // (int) - number of page. Show the posts that would normally show up just on page X when using the "Older Entries" link. | |
'posts', // | |
'withcomments', // | |
'withoutcomments', // | |
'search', // | |
'exact', // | |
'sentence', // | |
'calendar', // | |
'tb', // | |
'pb', // | |
'static', // | |
'comments_popup', // | |
'attachment', // | |
'attachment_id', // | |
'feed', // | |
'subpost', // | |
'subpost_id', // | |
'preview', // | |
'robots', // | |
'term', // | |
'cpage', // | |
'posts_per_page' // | |
].sort(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment