1. Home
  2. WC Vendors Marketplace
  3. Reserved words in WordPress
  1. Home
  2. Troubleshooting
  3. Reserved words in WordPress

Reserved words in WordPress

There is a list of words or terms in WordPress which should not be used under some circumstances as they may cause conflicts with WordPress Core functionality. Using such reserved words or terms may result in some odd errors such as unexplained 404 redirects, template reverting to index.php when it should not or form data not getting saved.

If such reserved words are used, it may cause some issues that are very hard to debug as WordPress would not provide debugging information that will be useful. For example, when adding a reserved word to the query arguments, it may not resolve as required and would lead to a 404 error which will be hard to debug especially when added using an interface that works with other words or a code snippet that is logically correct. In this case, pointing out the issue will be very difficult because there will be no obvious issue in the logic of the code unless one knows the issue related to reserved words, it will be hard finding what the actual issue is.

Avoid these words in the following conditions:

  • Passing the word to a $_POST or $_GET request array.
  • Registering a post type or taxonomy
  • Handling query variables

This applies both when doing this in code using a plugin that allows you to this in a user interface, as long as the underlying code will conflict with WordPress core, then those words should not be used.

Should you encounter some unknown issues when using such words, the easiest solution is to prefix such words, like ‘book_author’ instead of ‘author’, but the best solution is to avoid using them altogether or use their synonyms if preferable.

Reserved words in WordPress core

Below is a list of reserved words in WordPress sourced from the WordPress Codex, there is also a list of Global Variables that may cause conflicts when used.

attachment
attachment_id
author
author_name
calendar
cat
category
category__and
category__in
category__not_in
category_name
comments_per_page
comments_popup
custom
customize_messenger_channel
customized
cpage
day
debug
embed
error
exact
feed
hour
link_category
m
minute
monthnum
more
name
nav_menu
nonce
nopaging
offset
order
orderby
p
page
page_id
paged
pagename
pb
perm
post
post__in
post__not_in
post_format
post_mime_type
post_status
post_tag
post_type
posts
posts_per_archive_page
posts_per_page
preview
robots
s
search
second
sentence
showposts
static
subpost
subpost_id
tag
tag__and
tag__in
tag__not_in
tag_id
tag_slug__and
tag_slug__in
taxonomy
tb
term
terms
theme
title
type
w
withcomments
withoutcomments
year

This is not a full list of the words or terms, visit the Reserved Terms page in WordPress Codex for a full list of reserved words or terms.

Updated on July 25, 2020

Was this article helpful?