Tour of The Core

Tour of The Core

The core does not include your custom files for plugins, themes, database settings, the.htaccess file, and so on. The core also does not include any media you have uploaded to WordPress. Basically, any files added to WordPress after installation are considered outside of the core.
In short, the core contains several major function types:
  • Posts, pages, and custom content
  • Post types, taxonomies, and metadata
  • categories to user‐created taxonomies.
  • Themes
  • Actions, filters, and plugins
  • Users and authors
  • Feeds, formatting, and comments
Inline DocumentationNearly all WordPress core files contain inline documentation in PHPDoc form. PHPDoc is a standardized method of describing a function’s usage in PHP comment form. This means each function is explained in detail directly before the function in a comment block. The following is the defined template for documenting a WordPress function:

/**
* Short Description
*
* Long Description
*
* @package WordPress
* @since version
*
* @param type $varname Description
* @return type Description
*/

This is amazingly helpful in understanding how functions work. The comment includes a short and long description. It also includes the version of WordPress it was added in. This helps distinguish new functions added to WordPress when a new version is released.

Exploring the Core

 All of the files listed in the section that follows are located in the
/wp‐includes directory of WordPress.

Functions.php

The functions.php file contains the main WordPress API functions.  Plugins, themes, and the WordPress core all use these functions:

  • current_time()—Retrieves the current time based on the specified type.
  • force_ssl_login()—Requires SSL (https) login to WordPress.
  • wp_nonce_field()—Adds a nonce hidden field for forms. A nonce field is used for verification purposes when submitting and processing data in WordPress. This is a critical step in securing your code.
  • absint()—Converts value to a non-negative integer.
  • wp_die()—Kills the WordPress execution and displays an HTML error message.
Plugin.php

The plugin.php file contains the WordPress Plugin API functions, including:
  •  
  • add_filter()—Hooks that the WordPress core launches to filter content before displaying on the screen or saving in the database
  • add_action()—Hooks that the WordPress core launches at specifying points of execution
  • register_activation_hook()—Hook called when a plugin is activated
  • register_deactivation_hook()—Hook called when a plugin is deactivated
  • plugin_dir_url()—Returns the file system directory path for the plugin
  • plugin_dir_path()—Returns the URL for the plugin
  • doing_filter() and doing_action()—Returns the name of the current filter or action being processed

User.php

The user.php fle contains the WordPress User API functions, including:
  •  
  • get_users()—Returns a list of users matching criteria provided
  • add_user_meta(), get_user_meta(), delete_user_meta()—Used to create, retrieve, and delete user metadata
  • username_exists()—Checks if a username exists
  • email_exists()—Checks if an e‐mail address exists
  • wp_insert_user() and wp_update_user()—Create and update a user account

Post.php

The post.php fle contains the functions used in the post process of WordPress, including:
  • wp_insert_post()—Creates a new post
  • get_post()—Retrieves a single post with all post data
  • get_posts()—Retrieves a list of the latest posts’ matching criteria
  • add_post_meta()—Creates metadata (custom f eld data) on a post
  • get_post_meta()—Retrieves metadata (custom feld data) on a post
  • get_post_custom()—Returns a multidimensional array with all metadata (custom f eld)
    set_post_thumbnail()—Sets a featured image on a post
  • register_post_type()—Registers a custom post type in WordPress
Taxonomy.php

The taxonomy.php file contains the functions used by the WordPress Taxonomy API. Taxonomies are used to manage the hierarchical relationships of metadata such as categories and tags 

  • register_taxonomy()—Register a custom taxonomy in WordPress
  • get_taxonomies()—Return a list of registered taxonomies
  • wp_insert_term(), wp_update_term()—Insert or update a taxonomy term based on arguments provided

WordPress APIs

 APIs as gateways that let you add functionality or retrieve external content within WordPress without violating the “don’t hack the core” maxim: Most APIs insert references to non‐core code that will
be added to the
wp‐content directory by registering its entry points with WordPress. 

WordPress APIs:
1. Plugin API
2. Widget API
3. Shortcode API
4. HTTP API
5. Setting API
6. OPtion API
7. Dashboard API
8. Rewrite API


What Is the Codex?

The WordPress Codex is an online wiki for WordPress documentation located on WordPress.org. WordPress.org describes Codex as an “encyclopedia of WordPress knowledge.” 

An extensive glossary of terms is available for the Codex. This can help familiarize you with common words used throughout the Codex. You can view the official Codex Glossary athttp://codex.wordpress.org/Glossary. 

A WordPress Lessons page is also featured in the Codex at 

http://codex.wordpress.org/

WordPress_Lessons
. This page provides lessons on how to learn specific elements of WordPress. The lessons are organized by topic and are a great place to start if you are unsure of what to read first.  



Comments