In the WordPress core there are many files that contain many of the most popular WordPress functions in these files. Functions are used for all WordPress APIs functionality and can be used in any custom theme or plugin. The Following article has detail of the WordPress core files that contain back bone of code for working with WordPress CMS. All of the files listed in the article that follows are located in the directory of /wp-includes.
Functions.php
First functions.php file it contains the main WordPress API functions, all functions that are using in wordpress. WordPress these functions are used to easily interact with WordPress using a standardized method of it. Themes Plugins, and the WordPress all core use these functions:
- current_time — IT retrieves the current time based on specified type of time.
- force_ssl_login — It requires SSL (https) login to WordPress CMS.
- wp_nonce_field — It displays a nonce hidden field for forms. And nonce field is used for verification purposes when submitting and processing data in WordPress CMS. It is a critical step in securing your code with hackers.
- absint — The converts the value into nonnegative integer.
Option.php
In the option.php file contains the main WordPress Options API functions exist and these functions use for different purposes as mentioned below:
- add_option, update_option, get_option — It functions to create or generate, update, and display a saved option in database.
- set_transient, get_transient, delete_transient — This functions has responsibility of create, retrieve, and delete transients in WordPress. This an option with an expiration time. When the expiration time is hit then transient is automatically deleted in WordPress CMS.
- add_site_option, update_site_option, get_site_option — This functions is to generate or create, update, and display site options that are available. Multisite option is enabled then the function returns the network option, otherwise it returns the standard site option.
Formatting.php
In the formatting.php file contains the WordPress API formatting functions and these functions format the output in many different ways read the responsibilities of function below:
- esc_attr — It is used to escape a string for HTML attributes.
- esc_html — This function is Used to escape a string for HTML.
- esc_url — This function is Used to check and clean a URL.
- sanitize_text_field — It is for Sanitizes a string from user input or from the database.
- is_email — It Verifi es that an e-mail address is valid or not.
- capital_P_dangit — It is famous filter that forces the P in WordPress to be capitalized when displaying in content of wordperss.
Option.php
In the option.php file contains the main WordPress Options API functions exist and these functions use for different purposes as mentioned below:
- add_option, update_option, get_option — It functions to create or generate, update, and display a saved option in database.
- set_transient, get_transient, delete_transient — This functions has responsibility of create, retrieve, and delete transients in WordPress. This an option with an expiration time. When the expiration time is hit then transient is automatically deleted in WordPress CMS.
- add_site_option, update_site_option, get_site_option — This functions is to generate or create, update, and display site options that are available. Multisite option is enabled then the function returns the network option, otherwise it returns the standard site option.
Formatting.php
In the formatting.php file contains the WordPress API formatting functions and these functions format the output in many different ways read the responsibilities of function below:
- esc_attr — It is used to escape a string for HTML attributes.
- esc_html — This function is Used to escape a string for HTML.
- esc_url — This function is Used to check and clean a URL.
- sanitize_text_field — It is for Sanitizes a string from user input or from the database.
- is_email — It Verifi es that an e-mail address is valid or not.
- capital_P_dangit — It is famous filter that forces the P in WordPress to be capitalized when displaying in content of wordperss.
Pluggable.php
This pluggable functions file lets you override certain core functions of WordPress. The WordPress loads these functions if they are still undefined after all plugins have been loaded in WordPress. There are the more commonly used functions mentioned below:
- wp_mail — This function is use for sends e-mail from WordPress.
- get_userdata — This function returns all user data from the specified user ID.
- get_currentuserinfo — This function returns user data for the currently logged-in user.
- wp_set_password — This function updates a user’s password with a new encrypted one.
- wp_rand — This function Generates a random number.
- wp_logout — This function Logs out a user, destroying the user session.
- wp_redirect — This function redirects to another page.
- get_avatar — This function returns the user’s avatar.
Plugin.php
This file plugin.php contains the WordPress Plugin API functions see below:
- add_filter — The add_filter function is used for the Hooks so that the core launches for filtering content before it displays it on the screen or save it in the database.
- add_action — The add_action function Hooks the WP core for launching at specific points of execution.
- register_activation_hook — This function is called when any plugin is activated in WP.
- register_deactivation_hook — This function is called when any plugin is deactivated in WP.
- plugin_dir_url — This function is returning the directory URL for the plugin.
- plugin_dir_path — This function is used to return the path for the plugin.
User.php
This file user.php contains the WordPress User API functions see below all the functions:
- get_users — This function returns a list of users matching criteria provided.
- add_user_meta, get_user_meta, delete_user_meta — This function used to create or generate, retrieve, and delete
- user metadata.
- username_exists — This function is used to check if a username exists.
- email_exists — This function is used to check if an e-mail address exists.
- wp_insert_user and wp_update_user — This function create and update a user account.
Post.php
This file post.php contains the functions used in the post process of WordPress all the functionality controlled by these functions, see below all the function and its responsibility:
- wp_insert_post — This function creates a new post.
- get_posts — This function retrieves a list of the latest posts’ matching criteria.
- add_post_meta — This function creates metadata (custom field data) on a post.
- get_post_meta — This function retrieves metadata (custom
- field data) on a post.
- get_post_custom — This function returns a multidimensional array with all metadata (custom field)
- entries for a post.
- set_post_thumbnail — This function sets a featured image on a post.
- register_post_type — This function registers a custom post type in WordPress.
Registration functions of the plugin are add_filter() and add_hook() and they are key to extending how WordPress processes content so these functions let you extend the basic content data structures used by the WordPress.
Taxonomy.php
The functions used by the WordPress Taxonomy API this file name is taxonomy.php, and these are used to manage the hierarchical relationships of metadata such as categories and tags, taxonomy read in detail in other article now only functions ha s discussed and Functions in this file include:
- register_taxonomy — This function registers a custom taxonomy in WordPress.
- get_taxonomies — This function returns a list of registered taxonomies.
- wp_insert_term, wp_update_term — This function insert or update a taxonomy term based on arguments provided.
When developing custom themes and plugins for WordPress then many more core functions that can be used. These explore the core files inside /wp-includes only. Most of the WordPress API core function contains this directory files. Here we want to give you a method that if you want to learn more about any function listed here, please open up the corresponding file and view the source code of this function. Each function will have inline documentation explaining how to utilize the function correctly, every Web Design Agency Cape Town do this method.