Useful WordPress Code Snippets for Beginners: A Comprehensive Guide
WordPress is the world’s most popular content management system (CMS), powering over 43% of the internet. Its flexibility and user-friendliness make it ideal for beginners, but many new users are unaware of how much they can customize and optimize their sites using simple code snippets.
Code snippets are small blocks of code that modify WordPress’s default behavior without requiring complex plugins. They let you tweak everything from the admin dashboard to frontend design, improve performance, enhance security, and more—all without writing a full plugin.
You don’t need to be a developer to use these snippets! With a basic understanding of where to add code and how to test changes, you can unlock powerful customizations. This guide will walk you through 25+ practical, beginner-friendly snippets, organized by use case, with step-by-step explanations.
Table of Contents#
- How to Add Code Snippets to WordPress Safely
- Basic Setup & Configuration
- Changing the Login Logo
- Customizing Footer Text
- Disabling WordPress Version Number
- Setting Default Post Format
- Changing Admin Email Without Dashboard Access
- Customizing the Admin Area
- Hiding Unnecessary Admin Menu Items
- Changing Default Admin Color Scheme
- Adding a Custom Dashboard Widget
- Removing the Welcome Panel
- Limiting Post Revisions
- Enhancing Posts & Pages
- Custom Excerpt Length
- Removing "Category:" from Archive Titles
- Adding a Custom "Read More" Link
- Displaying Post Views
- Adding Custom Fields to Posts
- User Management
- Disabling User Registration
- Changing Default User Role for New Registrations
- Adding a Custom User Role
- Hiding the Admin Bar for Non-Administrators
- Limiting Failed Login Attempts
- Performance & Security
- Disabling Emoji Support
- Disabling XML-RPC
- Adding Security Headers
- Enabling GZIP Compression
- Lazy Loading Images
- Advanced Customizations (Optional)
- Creating a Custom Post Type
- Adding Custom Taxonomies
- Enqueuing Custom CSS/JavaScript
- Conclusion
- References
How to Add Code Snippets to WordPress Safely#
Before diving into snippets, always back up your site. A single typo can break your site, so backups ensure you can restore quickly. Here are the safest ways to add snippets:
1. Using a Child Theme’s functions.php File#
A child theme inherits styles and functionality from a parent theme, so changes won’t be overwritten when the parent theme updates.
- How to use:
- Create a child theme (if you don’t have one) using WordPress’s guide.
- Navigate to
Appearance > Theme Editorin your dashboard. - Select your child theme, then open
functions.php. - Paste the snippet at the bottom (before
?>if present).
2. Creating a Custom Plugin#
For snippets you want to keep even if you switch themes, create a simple plugin:
- How to use:
- Create a new folder in
wp-content/plugins/(e.g.,my-custom-snippets). - Inside the folder, create a file named
my-custom-snippets.php. - Add this header at the top:
<?php /* Plugin Name: My Custom Snippets Description: A collection of custom WordPress snippets. Version: 1.0 Author: Your Name */ - Paste snippets below the header.
- Activate the plugin via
Plugins > Installed Plugins.
- Create a new folder in
3. Using the Code Snippets Plugin (Recommended for Beginners)#
The Code Snippets plugin lets you add, manage, and activate snippets via a user-friendly interface—no file editing required.
- How to use:
- Install and activate the plugin.
- Go to
Snippets > Add New. - Enter a title (e.g., "Change Login Logo"), paste the snippet, and click "Save Changes and Activate".
1. Basic Setup & Configuration#
These snippets help you tweak foundational settings to match your site’s needs.
Snippet 1: Change the Login Logo#
Purpose: Replace the default WordPress logo on the login page with your brand logo.
Snippet:
function custom_login_logo() {
echo '<style type="text/css">
h1 a { background-image: url('.get_stylesheet_directory_uri().'/images/login-logo.png) !important;
background-size: contain !important;
width: 200px !important;
height: 80px !important; }
</style>';
}
add_action('login_head', 'custom_login_logo');
// Optional: Change the logo link URL
function custom_login_logo_url() {
return home_url();
}
add_filter('login_headerurl', 'custom_login_logo_url');
// Optional: Change the logo alt text
function custom_login_logo_url_title() {
return 'Your Site Name';
}
add_filter('login_headertitle', 'custom_login_logo_url_title'); Explanation:
custom_login_logo()injects CSS to replace the logo.get_stylesheet_directory_uri()points to your child theme’s folder (store your logo inchild-theme/images/login-logo.png).- Optional filters change the logo’s link (to your homepage) and alt text.
Where to Add: Child theme functions.php, custom plugin, or Code Snippets.
Notes:
- Use a PNG logo with transparent background for best results.
- Adjust
widthandheightto match your logo’s dimensions.
Snippet 2: Customize Footer Text#
Purpose: Replace the default "Powered by WordPress" text in your theme’s footer.
Snippet:
function custom_footer_text() {
remove_action('twentytwentyone_credits', 'twentytwentyone_credits'); // Replace with your theme's action
add_action('twentytwentyone_credits', 'my_custom_credits');
}
function my_custom_credits() {
echo '© ' . date('Y') . ' Your Site Name. All rights reserved.';
}
add_action('after_setup_theme', 'custom_footer_text'); Explanation:
- Themes use unique actions for footers (e.g.,
twentytwentyone_creditsfor Twenty Twenty-One). Find your theme’s footer action by checking itsfooter.phpfile. remove_action()deletes the default text;add_action()adds your custom text.
Where to Add: Child theme functions.php or Code Snippets.
Notes:
- To find your theme’s footer action: Go to
Appearance > Theme Editor, openfooter.php, and look fordo_action('theme-slug_credits').
Snippet 3: Disable WordPress Version Number#
Purpose: Hide the WordPress version (?ver=6.4) from scripts and styles to avoid revealing potential vulnerabilities.
Snippet:
function remove_wp_version() {
return '';
}
add_filter('the_generator', 'remove_wp_version'); // Removes version from RSS/Atom feeds
add_filter('style_loader_src', 'remove_wp_version', 9999); // Removes from stylesheets
add_filter('script_loader_src', 'remove_wp_version', 9999); // Removes from scripts Explanation:
the_generatorfilter removes the version from feeds.style_loader_srcandscript_loader_srcstrip the?verparameter from CSS/JS URLs.
Where to Add: Any method (child theme, plugin, or Code Snippets).
Notes: This won’t break functionality—browsers still cache files correctly.
Snippet 4: Set Default Post Format#
Purpose: Automatically set new posts to a specific format (e.g., "Standard", "Gallery", "Video").
Snippet:
function set_default_post_format($post_ID) {
if (get_post_format($post_ID) === false) {
set_post_format($post_ID, 'standard'); // Replace 'standard' with 'gallery', 'video', etc.
}
}
add_action('publish_post', 'set_default_post_format'); Explanation:
publish_postruns when a post is published.get_post_format()checks if a format is already set; if not,set_post_format()applies your default (e.g.,'standard').
Where to Add: Any method.
Notes: Valid formats: standard, aside, chat, gallery, link, image, quote, status, video, audio.
Snippet 5: Change Admin Email Without Dashboard Access#
Purpose: Update the site admin email if you can’t access the dashboard (e.g., due to a locked account).
Snippet:
function update_admin_email() {
$new_email = '[email protected]'; // Replace with your email
$admin_user = get_user_by('email', get_option('admin_email'));
if ($admin_user) {
$admin_user->user_email = $new_email;
wp_update_user($admin_user);
update_option('admin_email', $new_email);
echo 'Admin email updated to: ' . $new_email;
die(); // Stop execution after update
}
}
add_action('init', 'update_admin_email'); Explanation:
get_user_by('email', ...)fetches the current admin user.wp_update_user()updates the user’s email, andupdate_option('admin_email', ...)updates the site-wide email.
Where to Add: Temporarily add to functions.php or a custom plugin.
Notes:
- Remove the snippet after running it (it will echo a success message).
- Verify the new email via the dashboard afterward.
2. Customizing the Admin Area#
Simplify the WordPress dashboard to focus on what you need.
Snippet 1: Hide Unnecessary Admin Menu Items#
Purpose: Remove menu items (e.g., "Comments", "Tools") for non-administrator users.
Snippet:
function hide_admin_menu_items() {
$user = wp_get_current_user();
if (!in_array('administrator', $user->roles)) { // Show only to admins
remove_menu_page('edit-comments.php'); // Comments
remove_menu_page('tools.php'); // Tools
remove_menu_page('options-general.php'); // Settings
}
}
add_action('admin_menu', 'hide_admin_menu_items'); Explanation:
wp_get_current_user()checks the logged-in user’s role.remove_menu_page()hides specific menu slugs (find slugs here).
Where to Add: Any method.
Notes: Common slugs: index.php (Dashboard), edit.php (Posts), upload.php (Media), link-manager.php (Links).
Snippet 2: Change Default Admin Color Scheme#
Purpose: Set a default color scheme for new users (e.g., "Blue", "Coffee", "Ectoplasm").
Snippet:
function set_default_admin_color_scheme($user_id) {
$args = array(
'ID' => $user_id,
'admin_color' => 'ectoplasm' // Replace with your scheme
);
wp_update_user($args);
}
add_action('user_register', 'set_default_admin_color_scheme'); Explanation:
user_registerruns when a new user is created.admin_coloraccepts:fresh(default blue),light,blue,coffee,ectoplasm,midnight,ocean,sunrise.
Where to Add: Any method.
Notes: To preview schemes, go to Users > Your Profile > Admin Color Scheme.
Snippet 3: Add a Custom Dashboard Widget#
Purpose: Display helpful info (e.g., support links, to-do lists) on the admin dashboard.
Snippet:
function add_custom_dashboard_widget() {
wp_add_dashboard_widget(
'custom_dashboard_widget', // Widget ID
'Site Quick Links', // Title
'display_custom_dashboard_widget' // Callback function
);
}
function display_custom_dashboard_widget() {
echo '<p>Need help? Contact support at <a href="mailto:[email protected]">[email protected]</a>.</p>';
echo '<p>To-do: Update homepage banner by Friday.</p>';
}
add_action('wp_dashboard_setup', 'add_custom_dashboard_widget'); Explanation:
wp_add_dashboard_widget()registers the widget.display_custom_dashboard_widget()defines the content (HTML).
Where to Add: Any method.
Notes: Use HTML/CSS in the callback to style the widget (e.g., <ul>, <strong>).
Snippet 4: Remove the Welcome Panel#
Purpose: Hide the "Welcome to WordPress" panel that appears for new users.
Snippet:
remove_action('welcome_panel', 'wp_welcome_panel'); Explanation:
welcome_panelis the action that displays the panel.remove_action()deactivates it.
Where to Add: Any method.
Snippet 5: Limit Post Revisions#
Purpose: Prevent WordPress from storing unlimited post revisions (which bloat your database).
Snippet:
define('WP_POST_REVISIONS', 5); // Keep last 5 revisions Explanation:
- Add this to
wp-config.php(notfunctions.php). It limits revisions to 5 per post.
Where to Add: wp-config.php (in your site’s root folder).
Notes:
- Find
wp-config.phpvia FTP or your hosting file manager. - Add the line before
/* That's all, stop editing! Happy publishing. */.
3. Enhancing Posts & Pages#
Make your content more engaging and user-friendly.
Snippet 1: Custom Excerpt Length#
Purpose: Change the default excerpt length (55 words) to a custom number.
Snippet:
function custom_excerpt_length($length) {
return 30; // Show 30 words instead of 55
}
add_filter('excerpt_length', 'custom_excerpt_length', 999); Explanation:
excerpt_lengthfilter controls the word count. The999priority ensures your snippet overrides defaults.
Where to Add: Any method.
Notes: To change the "Read More" text, add:
function custom_excerpt_more($more) {
return '... <a href="'.get_permalink().'" class="read-more">Read More</a>';
}
add_filter('excerpt_more', 'custom_excerpt_more'); Snippet 2: Remove "Category:" from Archive Titles#
Purpose: Clean up archive page titles (e.g., "Category: Travel" → "Travel").
Snippet:
function remove_category_prefix($title) {
if (is_category()) {
$title = single_cat_title('', false);
}
return $title;
}
add_filter('get_the_archive_title', 'remove_category_prefix'); Explanation:
is_category()checks if the page is a category archive.single_cat_title('', false)returns the category name without the prefix.
Where to Add: Any method.
Notes: To remove "Tag:" or "Author:", add is_tag() or is_author() to the condition:
if (is_category() || is_tag() || is_author()) { ... } Snippet 3: Add a Custom "Read More" Link#
Purpose: Replace the default "Continue reading →" link with custom text and styling.
Snippet:
function custom_read_more_link() {
return '<a href="'.get_permalink().'" class="btn btn-primary">Read Full Article</a>';
}
add_filter('the_content_more_link', 'custom_read_more_link'); Explanation:
the_content_more_linkfilter modifies the link generated by the<!--more-->tag in posts.- Use HTML/CSS classes (e.g.,
btn btn-primaryfor Bootstrap styling) to customize the button.
Where to Add: Any method.
Snippet 4: Display Post Views#
Purpose: Track and show how many times a post has been viewed.
Snippet:
function track_post_views($post_id) {
$count_key = 'post_views_count';
$count = get_post_meta($post_id, $count_key, true);
if ($count == '') {
$count = 0;
delete_post_meta($post_id, $count_key);
add_post_meta($post_id, $count_key, '0');
} else {
$count++;
update_post_meta($post_id, $count_key, $count);
}
}
function display_post_views() {
$count = get_post_meta(get_the_ID(), 'post_views_count', true);
return 'Views: ' . $count;
} How to Use:
- Add this snippet to track views.
- To display views in your theme (e.g., in
single.phporcontent.php), add:<?php echo display_post_views(); ?>
Explanation:
track_post_views()increments a custom field (post_views_count) each time the post is viewed.display_post_views()retrieves and shows the count.
Where to Add: Any method.
Notes: To exclude admins from counting, add:
if (!is_admin()) { track_post_views(get_the_ID()); } Snippet 5: Add Custom Fields to Posts#
Purpose: Add extra fields (e.g., "Author Bio", "Source Link") to posts via the dashboard.
Snippet:
function add_custom_post_fields() {
add_meta_box(
'custom_post_fields', // ID
'Custom Post Details', // Title
'display_custom_post_fields', // Callback
'post', // Post type (use 'page' for pages)
'normal', // Context (normal, side, advanced)
'high' // Priority
);
}
add_action('add_meta_boxes', 'add_custom_post_fields');
function display_custom_post_fields($post) {
$author_bio = get_post_meta($post->ID, 'author_bio', true);
?>
<label for="author_bio">Author Bio:</label>
<textarea name="author_bio" id="author_bio" rows="3" style="width:100%;"><?php echo esc_attr($author_bio); ?></textarea>
<?php
}
function save_custom_post_fields($post_id) {
if (isset($_POST['author_bio'])) {
update_post_meta($post_id, 'author_bio', sanitize_textarea_field($_POST['author_bio']));
}
}
add_action('save_post', 'save_custom_post_fields'); How to Use:
- Add the snippet to enable the field in the post editor.
- To display the bio in your theme, use:
<?php echo get_post_meta(get_the_ID(), 'author_bio', true); ?>
Explanation:
add_meta_box()adds a custom box to the post editor.display_custom_post_fields()renders the textarea.save_postsaves the input to the database usingupdate_post_meta().
Where to Add: Any method.
Notes: Use sanitize_textarea_field() to clean user input and prevent XSS attacks.
4. User Management#
Control who can access and interact with your site.
Snippet 1: Disable User Registration#
Purpose: Turn off public user registration (default in some setups).
Snippet:
function disable_user_registration() {
update_option('users_can_register', 0);
}
add_action('init', 'disable_user_registration'); Explanation:
users_can_registeris the option that controls registration. Setting it to0disables registration.
Where to Add: Any method.
Notes: Verify via Settings > General—the "Anyone can register" checkbox will be unchecked.
Snippet 2: Change Default User Role for New Registrations#
Purpose: Set new users to "Subscriber" instead of "Contributor" (or vice versa).
Snippet:
function change_default_user_role() {
return 'subscriber'; // Default role (e.g., 'subscriber', 'contributor', 'editor')
}
add_filter('pre_option_default_role', 'change_default_user_role'); Explanation:
pre_option_default_rolefilter overrides the default role set inSettings > General.
Where to Add: Any method.
Notes: Valid roles: subscriber, contributor, author, editor, administrator.
Snippet 3: Add a Custom User Role#
Purpose: Create a role with specific permissions (e.g., "Photographer" who can upload images but not publish posts).
Snippet:
function add_custom_user_role() {
add_role(
'photographer', // Role ID
'Photographer', // Display name
array(
'read' => true,
'upload_files' => true,
'edit_posts' => true,
'delete_posts' => false, // Prevent deleting posts
'publish_posts' => false // Prevent publishing
)
);
}
add_action('init', 'add_custom_user_role'); Explanation:
add_role()creates a new role with granular capabilities (see WordPress capabilities list).
Where to Add: Any method.
Notes: To delete a role, use remove_role('photographer'); (run once, then remove the snippet).
Snippet 4: Hide Admin Bar for Non-Admins#
Purpose: Remove the black admin bar at the top of the site for non-administrator users.
Snippet:
function hide_admin_bar_for_non_admins() {
if (!current_user_can('administrator') && !is_admin()) {
show_admin_bar(false);
}
}
add_action('after_setup_theme', 'hide_admin_bar_for_non_admins'); Explanation:
current_user_can('administrator')checks if the user is an admin.show_admin_bar(false)hides the bar on the frontend (!is_admin()ensures it still shows in the dashboard).
Where to Add: Any method.
Snippet 5: Limit Failed Login Attempts#
Purpose: Block brute-force attacks by limiting login attempts (3 tries before temporary lockout).
Snippet:
function limit_login_attempts($username) {
$transient = 'login_attempts_' . $username;
$attempts = get_transient($transient);
if ($attempts >= 3) {
$remaining = ceil((get_transient_timeout($transient) - time()) / 60);
wp_die('Too many failed attempts. Try again in ' . $remaining . ' minutes.');
}
add_action('wp_login_failed', function() use ($username, $transient, $attempts) {
$attempts = ($attempts) ? $attempts + 1 : 1;
set_transient($transient, $attempts, 15 * 60); // Lockout for 15 minutes
});
}
add_action('wp_authenticate', 'limit_login_attempts', 10, 1); Explanation:
get_transient()tracks failed attempts using a temporary storage key (login_attempts_$username).- After 3 attempts,
wp_die()blocks further tries for 15 minutes.
Where to Add: Custom plugin or Code Snippets.
Notes: For production sites, use a plugin like Limit Login Attempts Reloaded for more features.
5. Performance & Security#
Keep your site fast and secure with these snippets.
Snippet 1: Disable Emoji Support#
Purpose: Remove unnecessary emoji scripts and styles (added in WordPress 4.2) to reduce load time.
Snippet:
function disable_emojis() {
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('admin_print_scripts', 'print_emoji_detection_script');
remove_action('wp_print_styles', 'print_emoji_styles');
remove_action('admin_print_styles', 'print_emoji_styles');
remove_filter('the_content_feed', 'wp_staticize_emoji');
remove_filter('comment_text_rss', 'wp_staticize_emoji');
remove_filter('wp_mail', 'wp_staticize_emoji_for_email');
add_filter('tiny_mce_plugins', 'disable_emojis_tinymce');
}
add_action('init', 'disable_emojis');
function disable_emojis_tinymce($plugins) {
if (is_array($plugins)) {
return array_diff($plugins, array('wpemoji'));
}
return $plugins;
} Explanation:
- This snippet removes all emoji-related scripts, styles, and filters from the frontend and admin.
Where to Add: Any method.
Notes: Test if your site uses emojis before disabling—some themes/plugins rely on them.
Snippet 2: Disable XML-RPC#
Purpose: Block XML-RPC (used for remote publishing) to prevent brute-force attacks.
Snippet:
function disable_xmlrpc() {
add_filter('xmlrpc_enabled', '__return_false');
}
add_action('init', 'disable_xmlrpc'); Explanation:
xmlrpc_enabledfilter disables thexmlrpc.phpfile, which is often targeted by attackers.
Where to Add: Any method.
Notes: If you use Jetpack or remote publishing tools, leave XML-RPC enabled.
Snippet 3: Add Security Headers#
Purpose: Protect against XSS, clickjacking, and other attacks with HTTP headers.
Snippet:
function add_security_headers($headers) {
$headers['X-Content-Type-Options'] = 'nosniff';
$headers['X-Frame-Options'] = 'SAMEORIGIN';
$headers['X-XSS-Protection'] = '1; mode=block';
$headers['Referrer-Policy'] = 'strict-origin-when-cross-origin';
return $headers;
}
add_filter('wp_headers', 'add_security_headers'); Explanation:
X-Content-Type-Options: Prevents MIME type sniffing.X-Frame-Options: Blocks clickjacking by restricting iframes.X-XSS-Protection: Enables browser XSS filtering.
Where to Add: Any method.
Notes: Test headers using Security Headers after adding.
Snippet 4: Enable GZIP Compression#
Purpose: Reduce file sizes (CSS, JS, HTML) for faster loading.
Snippet:
function enable_gzip_compression() {
if (!ob_start("ob_gzhandler")) ob_start();
}
add_action('init', 'enable_gzip_compression'); Explanation:
ob_gzhandlercompresses output before sending it to the browser.
Where to Add: Any method.
Notes: Some hosts enable GZIP by default. Check using GTmetrix—look for "GZIP compression" in the report.
Snippet 5: Lazy Load Images#
Purpose: Defer loading offscreen images to improve page speed.
Snippet:
function add_lazy_load_attribute($content) {
return str_replace('<img', '<img loading="lazy"', $content);
}
add_filter('the_content', 'add_lazy_load_attribute'); Explanation:
loading="lazy"is a native browser attribute that delays image loading until the user scrolls near them.
Where to Add: Any method.
Notes: Works in modern browsers (Chrome, Firefox, Edge). For older browsers, use a plugin like Lazy Load by WP Rocket.
6. Advanced Customizations (Optional)#
For beginners ready to explore more complex tweaks.
Snippet 1: Creating a Custom Post Type#
Purpose: Add a dedicated post type for unique content (e.g., "Books", "Testimonials").
Snippet:
function create_book_post_type() {
register_post_type('book',
array(
'labels' => array(
'name' => __('Books'),
'singular_name' => __('Book')
),
'public' => true,
'has_archive' => true,
'supports' => array('title', 'editor', 'thumbnail', 'excerpt'),
'menu_icon' => 'dashicons-book' // Use a [Dashicon](https://developer.wordpress.org/resource/dashicons/)
)
);
}
add_action('init', 'create_book_post_type'); Explanation:
register_post_type()defines a new post type (book) with labels, visibility, and supported features (title, editor, etc.).
Where to Add: Custom plugin or child theme functions.php.
Notes: Flush permalinks after adding: Go to Settings > Permalinks and click "Save Changes".
Snippet 2: Adding Custom Taxonomies#
Purpose: Create custom categories/tags for your custom post type (e.g., "Genre" for Books).
Snippet:
function create_genre_taxonomy() {
register_taxonomy(
'genre', // Taxonomy ID
'book', // Post type to attach to
array(
'labels' => array(
'name' => __('Genres'),
'singular_name' => __('Genre')
),
'hierarchical' => true, // True = categories, false = tags
'public' => true
)
);
}
add_action('init', 'create_genre_taxonomy'); Explanation:
register_taxonomy()links the "Genre" taxonomy to the "Book" post type.
Where to Add: Same as the custom post type snippet.
Snippet 3: Enqueuing Custom CSS/JavaScript#
Purpose: Add your own CSS or JS files to the site (e.g., a custom stylesheet).
Snippet:
function enqueue_custom_assets() {
// Enqueue custom CSS
wp_enqueue_style(
'custom-style', // Handle
get_stylesheet_directory_uri() . '/css/custom.css', // Path
array(), // Dependencies (none here)
'1.0' // Version
);
// Enqueue custom JS
wp_enqueue_script(
'custom-script', // Handle
get_stylesheet_directory_uri() . '/js/custom.js', // Path
array('jquery'), // Depends on jQuery
'1.0', // Version
true // Load in footer (true) or header (false)
);
}
add_action('wp_enqueue_scripts', 'enqueue_custom_assets'); Explanation:
wp_enqueue_style()andwp_enqueue_script()safely add assets, ensuring they load in the correct order.
Where to Add: Child theme functions.php or custom plugin.
Notes: Create css/custom.css and js/custom.js in your child theme folder first.
Conclusion#
These snippets empower you to customize, optimize, and secure your WordPress site without relying on heavy plugins. Start small—test one snippet at a time, back up your site, and use the Code Snippets plugin if you’re new to coding. As you gain confidence, experiment with advanced tweaks like custom post types or taxonomies.
Remember: WordPress is flexible, and these snippets are just the beginning. Always check the WordPress Codex or Developer Handbook to learn more about the functions used here.