Exploring the Code
The WordPress Core has certain files that contain several of the foremost popular WordPress functions. These functions are used for all WordPress API’s and may be employed in any custom plugin or theme.
In this post we detail the WordPress Core files that contain key items of code for operating with WordPress.
The functions.php file contains the most WordPress API functions. These functions are accustomed to simply act with WordPress employing a standardized technique. Plugins, themes, and also the WordPress Core all use these functions.
➤ current_time – retrieves the current time based on supported specified type
➤ add_option, update_option, get_option: Functions to create, update, and display a saved option
➤ force_ssl_login: needs SSL (https) login to WordPress
➤ wp_nonce_ays: Displays the ‘‘Are You Sure?’’ dialog box confirming the action
The formatting.php file contains the WordPress API formatting functions. These functions format the output in many alternative ways:
➤ wp_specialchars: Converts characters into hypertext markup language entities
➤ esc_attr: Used to clean a string containing hypertext markup language
➤ is_email: Verifies an e-mail is valid
The pluggable functions file allows you to override bound Core functions of WordPress. WordPress hundreds these functions if they’re still indefinable in spite of everything plugins are loaded. A number of the more normally used functions are listed here:
➤ wp_mail: Sends e-mail from WordPress
➤ get_userdata: Returns all user information from the specified user ID
➤ get_currentuserinfo: Returns user information for the presently logged-in user
➤ wp_signon: Authenticates a user
➤ wp_logout: Logs out a user, destroying the user session
➤ wp_redirect: Redirects to a different page
➤ get_avatar: Returns the user’s avatar
The plugin.php file contains the WordPress Plugin API functions. This includes:
➤ add_filter: Hooks that the WordPress Core launches to filter content before displaying on the screen or saving within the database
➤ add_action: Hooks that the WordPress Core launches at specific points of execution
➤ register_activation_hook: Hook referred to as once a plugin is activated
➤ register_deactivation_hook: Hook referred to as once a plugin is deactivated
The post.php file contains the functions employed in the post method of WordPress. This includes:
➤ wp_insert_post: Creates a replacement post
➤ get_posts: Retrieves a listing of the newest posts’ matching criteria
➤ get_pages: Retrieves a listing of pages permitting parent-child relationships
➤ add_post_meta: Creates metadata (custom field data) on a post
➤ get_post_meta: Retrieves metadata (custom field data) on a post
The category.php file contains the functions utilized by the WordPress category API. This includes:
➤ get_categories: Retrieves an array of category objects supported parameters
➤ get_cat_ID: Returns the category ID from its name
Many more Core functions you’ll be used once developing custom themes and plugins for WordPress. Take a number of minutes and explore the Core files within /wp-includes. This directory contains most of the WordPress API Core function files.
Keep in mind that every function can have inline documentation explaining a way to utilize the function properly.
What are your thoughts about this post? Let me know in the comments!
Did you like this article about various WordPress Core files? Share it with your friends on Facebook, Twitter, and Google Plus!
Don’t forget to Subscribe to our Newsletter for more insightful post updates, tips and guides!
See you in the next post.
Hi, I’m Aakanksha, a computer science engineer and the founder of TheTechPower. I help people make there online presence process easier by empowering them with clean, beautiful and easy to use wordpress themes.