"WordPress"

Introduction

WordPress (WP, WordPress.org) is a free and open-source content management system (CMS) written in PHP[4] and paired with a MySQL or MariaDB database.

Features include a plugin architecture and a template system, referred to within WordPress as Themes. WordPress was originally created as a blog-publishing system but has evolved to support other web content types including more traditional mailing lists and forums, media galleries, membership sites, learning management systems (LMS) and online stores.

To function, WordPress has to be installed on a web server, either part of an Internet hosting service like WordPress.com or a computer running the software package WordPress.org in order to serve as a network host in its own right.[10] A local computer may be used for single-user testing and learning purposes.

"WordPress is a factory that makes webpages"[11] is a core analogy designed to clarify the functions of WordPress: it stores content and enables a user to create and publish webpages, requiring nothing beyond a domain and a hosting service.

WordPress has a web template system using a template processor. Its architecture is a front controller, routing all requests for non-static URIs to a single PHP file which parses the URI and identifies the target page. This allows support for more human-readable permalinks.

Themes

WordPress users may install and switch among different themes. Themes allow users to change the look and functionality of a WordPress website without altering the core code or site content. Every WordPress website requires at least one theme to be present. Themes may be directly installed using the WordPress "Appearance" administration tool in the dashboard, or theme folders may be copied directly into the themes directory.[13] WordPress themes are generally classified into two categories: free and premium. Many free themes are listed in the WordPress theme directory (also known as the repository), and premium themes are available for purchase from marketplaces and individual WordPress developers. WordPress users may also create and develop their own custom themes.

Plugins

WordPress' plugin architecture allows users to extend the features and functionality of a website or blog. As of December 2021, WordPress.org has 59,756 plugins available,[15] each of which offers custom functions and features enabling users to tailor their sites to their specific needs. However, this does not include the premium plugins that are available (approximately 1,500+), which may not be listed in the WordPress.org repository. These customisations range from search engine optimization (SEO), to client portals used to display private information to logged-in users, to content management systems, to content displaying features, such as the addition of widgets and navigation bars. Not all available plugins are always abreast with the upgrades, and as a result, they may not function properly or may not function at all. Most plugins are available through WordPress themselves, either via downloading them and installing the files manually via FTP or through the WordPress dashboard. However, many third parties offer plugins through their own websites, many of which are paid packages.

Web developers who wish to develop plugins need to learn WordPress' hook system which consists of over 2,000 hooks (as of Version 5.7 in 2021)[16] divided into two categories: action hooks and filter hooks.

Plugins also represent a development strategy that can transform WordPress into all sorts of software systems and applications, limited only by the imagination and creativity of the programmers. These are implemented using custom plugins to create non-website systems, such as headless WordPress applications and Software as a Service (SaaS) products.

Plugins also could be used by hackers targeting the site that use WordPress, as hackers could exploit bugs on WordPress plugins themselves instead of exploiting the bugs on WordPress itself

Mobile Applications

Phone apps for WordPress exist for WebOS,[18] Android,[19] iOS,[20][21] Windows Phone and BlackBerry.[22] These applications, designed by Automattic, have options such as adding new blog posts and pages, commenting, moderating comments, replying to comments in addition to the ability to view the stats.

Accessibility

The WordPress Accessibility Team has worked to improve the accessibility for core WordPress as well as support a clear identification of accessible themes.[23] The WordPress Accessibility Team provides continuing educational support about web accessibility and inclusive design. The WordPress Accessibility Coding Standards state that "All new or updated code released in WordPress must conform with the Web Content Accessibility Guidelines 2.0 at level AA.

Code Tips
Is WordPress no code?

Building a WordPress site is mostly a code-free experience. We use the term mostly because using one of the many thousands of templates does not require coding knowledge. However, if any changes are made to the structure, styling, or even padding on a template, coding will be required.

Can I use WordPress for coding?

Does WordPress require coding? Yes. Some knowledge of coding would be helpful to changes to your website. Having a complete coding background while helpful is not required.

How do I write code in WordPress?

Simply edit the blog post or page where you want to display the code. On the post edit screen, add a new code block to your post. You can now enter the code "Snippet" in the text area of the block. After that, you can save your blog post and preview it to see the code block in action.

Codes Snippets for WordPress
Disable Admin Toolbar

Some caching systems will require you not to have different code for logged in users vs public users so disabling the WordPress admin toolbar can be useful for that case. If you want to disable the WordPress admin toolbar on all pages for logged in users use the snippet below in your themes functions.php. Example:

?php add_filter('show_admin_bar', '__return_false');
Add an Admin User with PHP

This code snippet is useful for adding a new admin to a site using the theme’s function.php. This snippet will make a user with the username/password/email set in the variables. It’s important to see that it will only try to make the user if it doesn’t exist based on the username/email so if you have an account with your email address already you can fill in email with dummy data:

function smartwp_create_admin_user(){ $username = 'yourusername'; $password = '2JyAEQJ9B9Jf5T8a'; $email = 'change@me.com'; } if ( !username_exists( $username ) && !email_exists( $email ) ) { $userid = wp_create_user( $username, $password, $email ); $user = new WP_User( $userid ); $user->set_role( 'administrator' ); }
Disable XML-RPC in WordPress

Very rarely do you need XML-RPC enabled on your WordPress site but having it enabled can cause a slew of security issues. If you use the WordPress app you may need to keep it enabled but I have rarely seen any case where XML-RPC enabled. This code snippet will disable XML-RPC to improve site security:

add_filter('xmlrpc_enabled', '__return_false');
Awards and Recognition