Your Ultimate Guide to WordPress Classes

WordPress Classes Cheat Sheet for Developers

Explanation of Columns:
Class Name: The name of the WordPress class.

Current Status: Indicates whether the class is currently working or deprecated.

PHP Version: The minimum PHP version required for the class.

Class Type: The type of class (e.g., Query Class, User Management, etc.).

Class Usage: Brief description of what the class does.

Built-in Extensions Available: Any built-in extensions or classes that extend this class.

Benefits: Benefits of using this class.

Tips: Tips for using this class effectively.

Alternates: Alternate methods or classes that provide similar functionality.

WP Class

WP Class TypeWP Class Uses

WP_List_Table

PHP Version: 5.6+

Admin UI Class

Usage: Base class for creating list tables in the WordPress admin.

Benefits: Simplifies creating tables for listing data in the admin area.

Tips: Extend this class to create custom list tables.

Alternates: Custom HTML tables using PHP and HTML.

Built-in Extensions Available: None

Current Status: Working

WP_Meta_Box

PHP Version: 5.6+

Admin UI Class

Usage: Handles adding custom meta boxes in the WordPress admin.

Benefits: Simplifies adding custom meta boxes to post editing screens.

Tips: Use add_meta_box() to register meta boxes.

Alternates: Custom admin UI using HTML and PHP.

Built-in Extensions Available: None

Current Status: Working

WP_Block_Type

PHP Version: 5.6+

Block Editor Class

Usage: Represents a block type in the WordPress block editor.

Benefits: Standardizes block creation and management.

Tips: Use register_block_type() to register custom blocks.

Alternates: Custom block implementations using JavaScript and PHP.

Built-in Extensions Available: None

Current Status: Working

WP_Comment

PHP Version: 5.6+

Comment Class

Usage: Represents a comment in WordPress.

Benefits: Provides a structured way to access comment data.

Tips: Use get_comment() to retrieve comment objects.

Alternates: Direct database access via $wpdb->get_row().

Built-in Extensions Available: None

Current Status: Working

WP_Customize_Control

PHP Version: 5.6+

Customizer Class

Usage: Base class for adding controls to the Customizer.

Benefits: Simplifies adding custom controls to the Customizer.

Tips: Use with WP_Customize_Manager to add customizer settings and controls.

Alternates: Custom admin pages or settings API.

Built-in Extensions Available: Core controls extend this class (e.g. WP_Customize_Color_Control)

Current Status: Working

WP_Customize_Manager

PHP Version: 5.6+

Customizer Class

Usage: Manages the Customizer interface.

Benefits: Provides a structured way to add and manage Customizer settings and controls.

Tips: Use with WP_Customize_Control to add customizer settings and controls.

Alternates: Custom admin pages or settings API.

Built-in Extensions Available: None

Current Status: Working

WP_Customize_Panel

PHP Version: 5.6+

Customizer Class

Usage: Represents a panel in the Customizer.

Benefits: Provides a structured way to add and manage Customizer panels.

Tips: Use with WP_Customize_Manager to add customizer panels.

Alternates: WP_Customize_Panel

Built-in Extensions Available: None

Current Status: Working

WP_Customize_Partial

PHP Version: 5.6+

Customizer Class

Usage: Represents a partial in the Customizer, allowing selective refresh.

Benefits: Improves performance by only refreshing parts of the preview.

Tips: Use in conjunction with WP_Customize_Manager and WP_Customize_Control.

Alternates: Custom admin pages or settings API.

Built-in Extensions Available: None

Current Status: Working

WP_Customize_Section

PHP Version: 5.6+

Customizer Class

Usage: Represents a section in the Customizer.

Benefits: Provides a structured way to add and manage Customizer sections.

Tips: Use with WP_Customize_Manager to add customizer sections.

Alternates: WP_Customize_Section

Built-in Extensions Available: None

Current Status: Working

WP_Customize_Setting

PHP Version: 5.6+

Customizer Class

Usage: Represents a setting in the Customizer.

Benefits: Provides a structured way to add and manage Customizer settings.

Tips: Use with WP_Customize_Manager and WP_Customize_Control.

Alternates: WP_Customize_Setting

Built-in Extensions Available: None

Current Status: Working

WP_Error

PHP Version: 5.6+

Error Handling

Usage: Represents an error in WordPress.

Benefits: Standardizes error handling across WordPress.

Tips: Check for errors using is_wp_error().

Alternates: Custom error handling classes or mechanisms.

Built-in Extensions Available: None

Current Status: Working

WP_Feed_Cache

PHP Version: 5.6+

Feed Parser Class

Usage: Handles caching of RSS feed data.

Benefits: Improves performance by caching feed data.

Tips: Use with fetch_feed() to parse and cache feeds.

Alternates: Custom caching solutions using transients or other methods.

Built-in Extensions Available: None

Current Status: Working

WP_Feed_Cache_Transient

PHP Version: 5.6+

Feed Parser Class

Usage: Handles transient-based caching of RSS feed data.

Benefits: Uses transients to cache feed data, improving performance.

Tips: Use with fetch_feed() to parse and cache feeds.

Alternates: Custom caching solutions using direct database access or other methods.

Built-in Extensions Available: None

Current Status: Working

WP_SimplePie_File

PHP Version: 5.6+

Feed Parser Class

Usage: Handles retrieving and caching feed data.

Benefits: Simplifies working with RSS feeds and other feed formats.

Tips: Use in conjunction with fetch_feed() to parse and cache feeds.

Alternates: Custom feed parsing solutions using SimplePie or other libraries.

Built-in Extensions Available: None

Current Status: Working

WP_Filesystem

PHP Version: 5.6+

Filesystem Class

Usage: Abstracts file system operations in WordPress.

Benefits: Simplifies file system operations, supports multiple methods (direct, FTP, SSH).

Tips: Use WP_Filesystem() to initialize and perform file operations.

Alternates: WP_Filesystem

Built-in Extensions Available: Extended by classes like WP_Filesystem_Direct, WP_Filesystem_SSH2, WP_Filesystem_FTPext, and WP_Filesystem_ftpsockets

Current Status: Working

WP_Hook

PHP Version: 5.6+

Hook System

Usage: Manages hooks and filters in WordPress.

Benefits: Standardizes hook management and execution.

Tips: Use to add or remove hooks and filters.

Alternates: WP_Hook

Built-in Extensions Available: None

Current Status: Working

WP_Http

PHP Version: 5.6+

HTTP API Class

Usage: Handles HTTP requests in WordPress.

Benefits: Simplifies making HTTP requests and handling responses.

Tips: Use for making remote requests and interacting with external APIs.

Alternates: WP_Http

Built-in Extensions Available: None

Current Status: Working

WP_Image_Editor

PHP Version: 5.6+

Image Management

Usage: Base class for handling image editing in WordPress.

Benefits: Standardizes image editing operations.

Tips: Use wp_get_image_editor() to get an instance of the image editor.

Alternates: WP_Image_Editor

Built-in Extensions Available: Extended by classes like WP_Image_Editor_GD and WP_Image_Editor_Imagick

Current Status: Working

WP_Image_Editor_GD

PHP Version: 5.6+

Image Management

Usage: Handles image editing using the GD library.

Benefits: Provides image editing capabilities using the GD library.

Tips: Use wp_get_image_editor() to get an instance of this editor.

Alternates: WP_Image_Editor_GD

Built-in Extensions Available: None

Current Status: Working

WP_Image_Editor_Imagick

PHP Version: 5.6+

Image Management

Usage: Handles image editing using the Imagick library.

Benefits: Provides image editing capabilities using the Imagick library.

Tips: Use wp_get_image_editor() to get an instance of this editor.

Alternates: WP_Image_Editor_Imagick

Built-in Extensions Available: None

Current Status: Working

WP_Locale

PHP Version: 5.6+

Locale Management

Usage: Handles localization and translation in WordPress.

Benefits: Simplifies managing translations and locale settings.

Tips: Use in conjunction with __() and _e() functions for translations.

Alternates: WP_Locale

Built-in Extensions Available: None

Current Status: Working

WP_Network

PHP Version: 5.6+

Multisite Class

Usage: Represents a network in a multisite installation.

Benefits: Provides a structured way to access network data.

Tips: Use get_network() to retrieve network objects.

Alternates: WP_Network

Built-in Extensions Available: None

Current Status: Working

WP_Site

PHP Version: 5.6+

Multisite Class

Usage: Represents a site in a multisite network.

Benefits: Provides a structured way to access multisite data.

Tips: Use get_site() to retrieve site objects.

Alternates: WP_Site

Built-in Extensions Available: None

Current Status: Working

WP_oEmbed

PHP Version: 5.6+

oEmbed Class

Usage: Handles embedding content from oEmbed providers.

Benefits: Simplifies embedding content from external providers.

Tips: Use wp_oembed_get() to embed content.

Alternates: WP_oEmbed

Built-in Extensions Available: None

Current Status: Working

WP_Post

PHP Version: 5.6+

Post Class

Usage: Represents a single post in WordPress.

Benefits: Provides a structured way to access post data.

Tips: Use get_post() to retrieve post objects.

Alternates: WP_Post

Built-in Extensions Available: None

Current Status: Working

WP_Meta_Query

PHP Version: 5.6+

Query Class

Usage: Handles complex meta queries in WordPress.

Benefits: Allows complex meta queries for posts, users, terms, etc.

Tips: Use in conjunction with WP_Query for advanced meta queries.

Alternates: WP_Meta_Query

Built-in Extensions Available: None

Current Status: Working

WP_Query

PHP Version: 5.6+

Query Class

Usage: Handles querying posts and pages in WordPress.

Benefits: Powerful and flexible, allows complex queries.

Tips: Use caching to improve performance.

Alternates: WP_Query

Built-in Extensions Available: None

Current Status: Working

WP_Site_Query

PHP Version: 5.6+

Query Class

Usage: Handles querying sites in a multisite network.

Benefits: Allows complex queries for sites in a multisite network.

Tips: Use in conjunction with WP_Site for advanced site queries.

Alternates: WP_Site_Query

Built-in Extensions Available: None

Current Status: Working

WP_Term_Query

PHP Version: 5.6+

Query Class

Usage: Handles querying terms in WordPress.

Benefits: Allows complex term queries.

Tips: Use in conjunction with WP_Term for advanced term queries.

Alternates: WP_Term_Query

Built-in Extensions Available: None

Current Status: Working

WP_REST_Controller

PHP Version: 5.6+

REST API Class

Usage: Base class for creating REST API controllers.

Benefits: Simplifies creating REST API endpoints.

Tips: Extend this class to add custom API routes.

Alternates: WP_REST_Controller

Built-in Extensions Available: None

Current Status: Working

WP_Role

PHP Version: 5.6+

Roles and Capabilities

Usage: Represents a user role in WordPress.

Benefits: Provides a structured way to manage user roles and capabilities.

Tips: Use get_role() to retrieve role objects.

Alternates: WP_Role

Built-in Extensions Available: None

Current Status: Working

WP_Session_Tokens

PHP Version: 5.6+

Sessions API Class

Usage: Manages user session tokens.

Benefits: Enhances security by managing user sessions.

Tips: Use in conjunction with wp_set_auth_cookie() and wp_clear_auth_cookie().

Alternates: WP_Session_Tokens

Built-in Extensions Available: None

Current Status: Working

WP_SimplePie_Sanitize_KSES

PHP Version: 5.6+

Feed Parser Class

Usage: Sanitizes feed data using KSES.

Benefits: Improves security by sanitizing feed data.

Tips: Use in conjunction with fetch_feed() to parse and sanitize feeds.

Alternates: WP_SimplePie_Sanitize_KSES

Built-in Extensions Available: None

Current Status: Working

WP_Taxonomy

PHP Version: 5.6+

Taxonomy Class

Usage: Represents a taxonomy in WordPress.

Benefits: Provides a structured way to manage taxonomies.

Tips: Use register_taxonomy() to register custom taxonomies.

Alternates: WP_Taxonomy

Built-in Extensions Available: None

Current Status: Working

WP_Term

PHP Version: 5.6+

Term Class

Usage: Represents a term in a taxonomy.

Benefits: Provides a structured way to manage terms.

Tips: Use get_term() to retrieve term objects.

Alternates: WP_Term

Built-in Extensions Available: None

Current Status: Working

WP_User

PHP Version: 5.6+

User Class

Usage: Represents a user in WordPress.

Benefits: Provides a structured way to manage user data.

Tips: Use get_user_by() to retrieve user objects.

Alternates: WP_User

Built-in Extensions Available: None

Current Status: Working

WP_User_Query

PHP Version: 5.6+

Query Class

Usage: Handles querying users in WordPress.

Benefits: Allows complex user queries.

Tips: Use in conjunction with WP_User for advanced user queries.

Alternates: WP_User_Query

Built-in Extensions Available: None

Current Status: Working

WP_Widget

PHP Version: 5.6+

Widget Class

Usage: Base class for creating widgets in WordPress.

Benefits: Simplifies creation of custom widgets.

Tips: Extend this class to create custom widgets.

Alternates: WP_Widget

Built-in Extensions Available: None

Current Status: Working

WP_Widget_Factory

PHP Version: 5.6+

Widget Class

Usage: Manages the registration of widgets.

Benefits: Standardizes widget registration and management.

Tips: Use in conjunction with WP_Widget to register custom widgets.

Alternates: WP_Widget_Factory

Built-in Extensions Available: None

Current Status: Working

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments