PHP Classes

File: vendor/wp-coding-standards/wpcs/WordPress/Docs/NamingConventions/ValidPostTypeSlugStandard.xml

Recommend this page to a friend!
  Classes of Adeleye Ayodeji   Nolimitbuzz WP Theme   vendor/wp-coding-standards/wpcs/WordPress/Docs/NamingConventions/ValidPostTypeSlugStandard.xml   Download  
File: vendor/wp-coding-standards/wpcs/WordPress/Docs/NamingConventions/ValidPostTypeSlugStandard.xml
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Nolimitbuzz WP Theme
WordPress theme to used as start of new themes
Author: By
Last change:
Date: 27 days ago
Size: 2,932 bytes
 

Contents

Class file image Download
<documentation title="Validate post type slugs"> <standard> <![CDATA[ The post type slug used in register_post_type() must be between 1 and 20 characters. ]]> </standard> <code_comparison> <code title="Valid: short post type slug."> <![CDATA[ register_post_type( <em>'my_short_slug'</em>, array() ); ]]> </code> <code title="Invalid: too long post type slug."> <![CDATA[ register_post_type( <em>'my_own_post_type_too_long'</em>, array() ); ]]> </code> </code_comparison> <standard> <![CDATA[ The post type slug used in register_post_type() can only contain lowercase alphanumeric characters, dashes and underscores. ]]> </standard> <code_comparison> <code title="Valid: no special characters in post type slug."> <![CDATA[ register_post_type( <em>'my_post_type_slug'</em>, array() ); ]]> </code> <code title="Invalid: invalid characters in post type slug."> <![CDATA[ register_post_type( <em>'my/post/type/slug'</em>, array() ); ]]> </code> </code_comparison> <standard> <![CDATA[ One should be careful with passing dynamic slug names to "register_post_type()", as the slug may become too long and could contain invalid characters. ]]> </standard> <code_comparison> <code title="Valid: static post type slug."> <![CDATA[ register_post_type( <em>'my_post_active'</em>, array() ); ]]> </code> <code title="Invalid: dynamic post type slug."> <![CDATA[ register_post_type( <em>"my_post_{$status}"</em>, array() ); ]]> </code> </code_comparison> <standard> <![CDATA[ The post type slug used in register_post_type() can not use reserved keywords, such as the ones used by WordPress itself. ]]> </standard> <code_comparison> <code title="Valid: prefixed post slug."> <![CDATA[ register_post_type( <em>'prefixed_author'</em>, array() ); ]]> </code> <code title="Invalid: using a reserved keyword as slug."> <![CDATA[ register_post_type( <em>'author'</em>, array() ); ]]> </code> </code_comparison> <standard> <![CDATA[ The post type slug used in register_post_type() can not use reserved prefixes, such as 'wp_', which is used by WordPress itself. ]]> </standard> <code_comparison> <code title="Valid: custom prefix post slug."> <![CDATA[ register_post_type( <em>'prefixed_author'</em>, array() ); ]]> </code> <code title="Invalid: using a reserved prefix."> <![CDATA[ register_post_type( <em>'wp_author'</em>, array() ); ]]> </code> </code_comparison> </documentation>