Most Popular and Common WordPress APIs

ADMEC Multimedia > Web Development > Most Popular and Common WordPress APIs

WordPress APIs are a great tool to customize it and interact with it. You can customize and create robust themes and custom features or plugins to use within the WordPress. A well written documentation of each API is available on Codex along with various examples of functions used in the API.

Below is the list of all common WordPress APIs:

1. Plugin API

These APIs are used to develop WordPress plugins or custom plugin development. Codex documentation features Plugin API in detail such as Hooks, Actions, and Filters.

Plugin API function location: /wp-includes/plugins.php

Common Filter and Action Functions:

Filter Functions
  • has_filter()
  • add_filter()
  • apply_filters()
  • apply_filters_ref_array()
  • current_filter()
  • remove_filter()
  • remove_all_filters()
  • doing_filter()
Actions Functions
  • has_action()
  • add_action()
  • do_action()
  • do_action_ref_array()
  • did_action()
  • remove_action()
  • remove_all_actions()
  • doing_action()

 For more info you can visit this link:

2. Widgets API 

Want to create your custom widget or looking for maintaining widgets in your plugin in WordPress then this API is quite useful.

Widgets API function location: /wp-includes/widgets.php

Common Widgets and Internal Functions:
Widget Functions
  • is_active_widget()
  • the_widget()
  • register_widget()
  • unregister_widget()
Internal Functions
  • wp_register_widget_control()
  • wp_unregister_widget_control()
  • wp_convert_widget_settings()
  • wp_get_widget_defaults()
  • wp_widget_description()

For more detail about Widgets API in WordPress please visit the following given link.

3. Shortcode API

If you have used few plugins in WordPress then I am sure you have encountered such plugins which ask you to add a short code or macro code in your page for the final result such as Google Map or image gallery. Looking for your own shortcode plugin development then must click on the following give link.


Want to create something that sends http request from WordPress then you are in right category of WordPress APIs. I want to make it little easy to you by giving some examples of the use of such API here.

  • Google Map API
  • Twitter API
  • Facebook API
Common HTTP API Functions

wp_remote_get() – Retrieves a URL using the GET HTTP method.

wp_remote_post() – Retrieves a URL using the POST HTTP method.

wp_remote_head() – Retrieves a URL using the HEAD HTTP method.

wp_remote_request() – Retrieves a URL using either the default GET or a custom HTTP method (should be caps) that you specify.

The other helper functions deal with retrieving different parts of the response and do the testing for WP_Error for you, these make usage of the API very simple and are the preferred method for processing response objects.

wp_remote_retrieve_body() – Retrieves just the body from the response.

wp_remote_retrieve_header() – Gives you a single HTTP header based on name from the response.

wp_remote_retrieve_headers() – Returns all of the HTTP headers in an array for processing.

wp_remote_retrieve_response_code() – Gives you the number for the HTTP response. This should be 200, but could be 4xx or even 3xx on failure.

wp_remote_retrieve_response_message() – Returns the response message based on the response code.

Almost every dynamic or static website needs an API integrated in it. So please click on the following URL to read more about HTTP API in WordPress.

5. Settings API 

Setting API as its name suggests are very useful to create or customize settings page. When we create a theme or a plugin in WordPress all the time we need to deal with settings. The best thing about settings API in WordPress is that it handles everything with security so we don’t need to worry about data validations, nonces, cross site scripting (XSS) attacks when saving data through the settings.

The settings API functions are found in wp-admin/includes/plugin.php and wp-admin/includes/template.php

Function Reference

Setting Register/Unregister
  • register_setting()
  • unregister_setting()
Add Field/Section
  • add_settings_field()
  • add_settings_section()
Options Form Rendering
  • settings_fields()
  • do_settings_sections()
  • do_settings_fields()
  • add_settings_error()
  • get_settings_errors()
  • settings_errors()

Read more about the Settings API on Codes:

6. Dashboard Widgets API 

Dashboard Widgets means the widgets or sections that you see on your WordPress website dashboard. If you want to create your own Dashboard Widget or want to custom any existing (you should not) you can use this WordPress API. It provides all the jQuery power such as collapsing, dragging, moving, or deleting a widget automatically when you use dashboard widgets API.

The main method or function need to add widgets to dashboard is:


How to use it

wp_add_dashboard_widget($widget_id,$widget_name, $callback, $control_callback = null)

  • $widget_id is a slug to identify your widget to be used as its CSS class and its key in the array of widgets.
  • $widget_name – this is the name your widget.
  • $callback – name of a function you will create that will display the actual contents of your widget.
  • $control_callback – (Optional) The name of a function you create that will handle submission of widget options forms, and will also display the form elements.

Read more on Codex about it:

7. Rewrite API 

This API is good to create human and search engine friendly keyword rich URLs as you do in your .htaccess file. You can plan custom permalink structure tags and can add static end points in your urls too.

Function location: /wp-includes/rewrite.php

Common rewrite hooks and functions:


  • Filter: root_rewrite_rules – It filters the rewrite rules generated for the root of your weblog.
  • Filter: post_rewrite_rules – It filters the rewrite rules generated for permalink URLs.
  • Filter: page_rewrite_rules – It filters the rewrite rules generated for your Pages.
  • Filter: date_rewrite_rules – It filters the rewrite rules generated for dated archive URLs.
  • Filter: search_rewrite_rules – It filters the rewrite rules generated for search URLs.
  • Filter: comments_rewrite_rules – It filters the rewrite rules generated for the latest comment feed URLs.
  • Filter: author_rewrite_rules – It filters the rewrite rules generated for author archive URLs.
  • Filter: rewrite_rules_array – It filters all the rewrite rules at once.
  • Filter: {$permastruct}_rewrite_rules – Can be used to create or modify rewrite rules for any custom permastructs, such as taxonomies or custom post types.
  • Action: generate_rewrite_rules – Runs after all the rules have been created. 


  • add_rewrite_tag() – Can be used to allow WordPress to recognize custom variables (particularly custom querystring variables).
  • add_rewrite_rule() – Allows you to specify new, custom rewrite rules.
  • add_rewrite_endpoint() – Add a new endpoint like /trackback/
  • flush_rules() – Regenerate the rewrite rules and save them to the database.
  • flush_rewrite_rules() – Remove rewrite rules and then recreate rewrite rules.
  • generate_rewrite_rules() – Generates rewrite rules from a permalink structure
  • add_permastruct() – Add a new permastruct
  • add_feed() – Add a new feed type like /atom1/

The rewrite API functions documentation is located in Codex at

View Full Presentation on slideshare:

WordPress and it’s Most Popular Plugins

WordPress | WordPress(CMS) | best CMS for beginners | popular WordPress plugins from ADMEC Multimedia Institute

Related Posts

Leave a Reply

Copy link
Powered by Social Snap