daily notes

Concept of Roles and Capabilities WordPress provides a role-based permission system that controls what actions a user can perform on a website. Instead of granting every user full administrative access, WordPress assigns each user a role, and each role contains a set of capabilities. A capability is a specific permission such as: editing posts publishing posts installing plugins managing options deleting users A role is simply a collection of capabilities. ...

March 5, 2026 · 5 min · Ashish Verma

daily notes

WordPress AJAX in Plugin Development AJAX in WordPress allows asynchronous server communication via admin-ajax.php or the REST API without reloading the page. In plugins, this is commonly implemented using wp_ajax_{action} and wp_ajax_nopriv_{action} hooks. AJAX request flow with admin-ajax.php JavaScript sends request to admin_url( 'admin-ajax.php' ) with an action parameter. WordPress routes the request to: wp_ajax_{action} for authenticated users wp_ajax_nopriv_{action} for unauthenticated users PHP callback processes data and outputs JSON. Script exits with exit; or wp_die();. ...

March 4, 2026 · 4 min · Ashish Verma

daily notes

rest_pre_serve_request filter) to intercept the data right before it’s sent and convert the JSON object into XML or CSV. An API is an Application Programming Interface. REST, which stands for “Representational State Transfer,” is a set of concepts for modeling and accessing your application’s data as interrelated objects and collections. API is a set of code that allows one system to interact (or “interface”) with another. REST – Representational State Transfer, or REST, provides standards that web systems can use to interface with each other. ...

March 3, 2026 · 10 min · Ashish Verma

daily notes

1. WordPress HTTP API Overview WordPress provides a standardized HTTP API for communicating with remote servers. Main Functions wp_remote_get() — Perform GET request wp_remote_post() — Perform POST request wp_remote_request() — Custom HTTP methods (PUT, DELETE, PATCH) wp_remote_retrieve_body() — Extract response body wp_remote_retrieve_response_code() — Get HTTP status code wp_remote_retrieve_headers() — Get response headers Core Classes WP_Http — Main HTTP wrapper class WP_Http_Curl — cURL transport WP_Http_Streams — Streams transport WP_Http_Response — Standardized response object ...

March 2, 2026 · 3 min · Ashish Verma

daily notes

WordPress Core APIs Overview: WordPress Core APIs provide functions to extend WordPress safely. They handle heavy-lifting tasks and ensure backward compatibility for plugins and themes. Core APIs Learned: Metadata API – manage metadata for posts, users, comments, terms Shortcode API – create dynamic shortcodes Admin Menus – add menus in admin dashboard Settings & Options API – manage plugin/theme settings Advanced Core APIs: HTTP API – remote requests with caching & authentication ...

February 27, 2026 · 2 min · Ashish Verma

daily notes

WP-CLI Overview WP-CLI (WordPress Command Line Interface) lets you manage a WordPress installation directly from the terminal. Instead of using the browser-based admin dashboard, you execute commands via SSH or a local terminal. It supports: Core management (install, update, downgrade) Plugin and theme management Database operations User and role management Content import/export Custom command development WP-CLI commands follow this structure: wp <entity> <subcommand> [options] [--global-parameters] Example: wp core update Installation (Quick Method) Download and make executable: ...

February 26, 2026 · 2 min · Ashish Verma

daily notes

In the context of the WordPress REST API a route is a URI which can be mapped to different HTTP methods. The mapping of an individual HTTP method to a route is known as an endpoint. The Route is the URL path itself The Endpoint is the combination of a Route and an HTTP Method (like GET, POST, or DELETE). /wp-json/ is a route, and when that route receives a GET request then that request is handled by the endpoint which displays what is known as the index for the WordPress REST API. ...

February 25, 2026 · 4 min · Ashish Verma

daily notes

get_template_directory_uri() Retrieves template directory URI for the active theme. Returns the URL of the parent theme directory get_header($name = null, $args = array()) { } Includes the header template for a theme or if a name is specified then a specialized header will be included. For the parameter, if the file is called “header-special.php” then specify “special”. get_theme_file_uri('/assets/css/style.css') The URL to a specific file, and it checks Child theme first, Then parent theme (fallback) ...

February 24, 2026 · 15 min · Ashish Verma

daily notes

WordPress REST API The WordPress REST API allows applications to interact with a WordPress site using JSON over HTTP. It exposes WordPress data (posts, pages, users, taxonomies, custom post types) through RESTful endpoints. It powers the WordPress Block Editor and enables headless architectures, custom dashboards, mobile apps, and external integrations. What Is REST? API – A set of rules that allows systems to communicate. REST (Representational State Transfer) – A standard for structuring APIs using: ...

February 23, 2026 · 2 min · Ashish Verma

daily notes

CSS Reset / Normalize *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; } Layout Structure (Flexbox) .container { width: 1200px; margin: 0 auto; } .header { display: flex; justify-content: space-between; align-items: center; } Grid Layout Example .post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; } Typography Precision Font Loading function basic_theme_fonts() { wp_enqueue_style( 'google-fonts', 'https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap', false ); } add_action('wp_enqueue_scripts', 'basic_theme_fonts'); Typography System body { font-family: 'Inter', sans-serif; font-size: 16px; line-height: 1.6; color: #222; } h1 { font-size: 40px; font-weight: 700; } h2 { font-size: 32px; font-weight: 600; } p { margin-bottom: 20px; } header.php <!DOCTYPE html> <html <?php language_attributes(); ?>> <head> <meta charset="<?php bloginfo('charset'); ?>"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <?php wp_head(); ?> </head> <body <?php body_class(); ?>> <header class="site-header"> <div class="container"> <h1 class="logo"> <a href="<?php echo home_url(); ?>"> <?php bloginfo('name'); ?> </a> </h1> <?php wp_nav_menu(array( 'theme_location' => 'primary', 'container' => 'nav', 'menu_class' => 'main-menu' )); ?> </div> </header> Register Menu function basic_theme_setup() { register_nav_menus(array( 'primary' => 'Primary Menu' )); } add_action('after_setup_theme', 'basic_theme_setup'); Responsive Design Viewport Meta <meta name="viewport" content="width=device-width, initial-scale=1.0"> Media Queries @media (max-width: 992px) { .container { width: 90%; } .post-grid { grid-template-columns: 1fr 1fr; } } @media (max-width: 600px) { .post-grid { grid-template-columns: 1fr; } } Custom Single Template <?php get_header(); ?> <main class="single-post container"> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <h1><?php the_title(); ?></h1> <?php the_content(); ?> <?php endwhile; endif; ?> </main> <?php get_footer(); ?>

February 19, 2026 · 2 min · Ashish Verma