Beginner WordPress Developer Flashcards

(756 cards)

1
Q

What is WordPress at the most basic level?

A

A web application that runs on a web server.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a web server?

A

A computer connected to the internet that is configured to serve web pages.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the tech stack called that WordPress typically runs on?

A

LAMP: Linux, Apache, MySQL, and PHP.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is Linux in the LAMP stack?

A

The operating system that manages the server’s hardware and software resources.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is Apache in the LAMP stack?

A

Web server software that responds to browser requests by serving web content.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is an alternative to Apache?

A

Nginx (pronounced “Engine-X”), generally faster for serving static content.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does the stack name change to when using Nginx instead of Apache?

A

LEMP: Linux, Nginx, MySQL, and PHP.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is MySQL used for in WordPress?

A

It is the database software that stores site information (e.g. posts, settings, users).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is PHP used for in WordPress?

A

A server-side programming language that creates dynamic web pages.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What type of files do Apache and Nginx serve by default?

A

Static files (HTML, images, video).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a Directory Index file?

A

The default file the web server looks for when serving a directory (commonly index.php or index.html).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What happens if no Directory Index file is found?

A

The server returns a 404 “Not found” error.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a Virtual Host in Apache?

A

A configuration that allows one server to serve multiple websites.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the equivalent of a Virtual Host in Nginx?

A

A Server Block.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

On which port do Apache and Nginx usually listen for HTTP requests?

A

Port 80.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does the DirectoryIndex directive do in Apache?

A

It specifies which index file to serve (e.g. index.php, index.html).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What does the index directive do in Nginx?

A

It specifies which index file to serve.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is the first thing that happens when a user visits a WordPress site?

A

The browser sends a request to the web server for the requested URL.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

How does the web server handle the request?

A

It determines which file to execute (usually index.php for front-end, or a file in wp-admin for admin).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What happens when the PHP file is executed?

A

PHP may interact with the MySQL database to retrieve data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What is sent back to the browser after the PHP execution?

A

HTML, CSS, and JavaScript code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What does the browser do with the response?

A

It renders the page and displays it to the user.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What makes a web server different from a regular computer?

A

It is configured with special software (e.g. Apache or Nginx) to serve web content.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Why is understanding servers important for WordPress developers?

A

It helps them know how WordPress works under the hood and how it interacts with web infrastructure.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What is the WordPress file structure?
A collection of files organized into a specific structure.
26
Why can you inspect the WordPress file structure?
Because WordPress is open source.
27
What is the root directory of a WordPress installation?
The main directory that contains the core WordPress files and three subdirectories.
28
What is the .htaccess file used for?
To configure the Apache web server for the WordPress installation.
29
Does Nginx support .htaccess files?
No, Nginx configurations are done in the main server block configuration.
30
What is in the license.txt file?
The GNU General Public License (version 2) for WordPress.
31
What is in the readme.html file?
Information about WordPress: installation, updates, system requirements, and links to online resources.
32
What is the purpose of index.php?
It is the directory index file executed when the root URL of the WordPress site is visited.
33
Which file does index.php include?
wp-blog-header.php.
34
Which file does wp-blog-header.php include?
wp-load.php.
35
Which file does wp-load.php include?
wp-config.php.
36
What is the purpose of wp-config.php?
It is the main configuration file for WordPress (database connection info, security keys, custom settings).
37
Which file does wp-config.php include?
wp-settings.php.
38
What does wp-settings.php do?
Sets up all the WordPress core functionality.
39
What is wp-activate.php used for?
To confirm the activation key after a user signs up for a new site (used in multisite or manual installs).
40
What is wp-comments-post.php used for?
To process submitted comments.
41
What is wp-cron.php used for?
To run scheduled tasks on a WordPress site.
42
When is wp-cron.php triggered?
Every time a WordPress page is requested.
43
What is wp-links-opml.php used for?
To generate an XML list of links (legacy feature for Link Manager, still included for compatibility).
44
What is wp-login.php used for?
To display the login form and process login requests.
45
What is wp-mail.php used for?
To process emails and publish posts via email (if the feature is enabled).
46
What is wp-signup.php used for?
To display the signup form for new sites in a WordPress multisite network.
47
What is wp-trackback.php used for?
To process trackback requests (notifications that another site linked to yours).
48
What is xmlrpc.php used for?
To process XML-RPC requests (used by remote apps like WordPress mobile apps).
49
What are the three main directories in the WordPress root directory?
wp-admin, wp-content, wp-includes.
50
What is the wp-admin directory used for?
It contains all the files for the WordPress admin interface.
51
What is the wp-content directory used for?
It stores plugins, themes, uploaded files, and plugin-created directories.
52
What is the wp-includes directory used for?
It contains the bulk of WordPress core files, APIs, and shared functionality (used by both admin and front-end).
53
What does WordPress use a database for?
To store, retrieve, and display all the content (posts, pages, comments, users, site options).
54
Which database management system does WordPress use?
MySQL.
55
What is MySQL?
A free, open-source database management system used by many web applications.
56
What tool is commonly used to interact with a WordPress database?
phpMyAdmin.
57
What is an alternative to phpMyAdmin?
Adminer (a single PHP file providing similar functionality).
58
What is another option to interact with the database via WordPress dashboard?
SQL Buddy (a plugin — should be deactivated after use for security).
59
Where is the database table prefix defined?
In the wp-config.php file.
60
What is the default database table prefix in WordPress?
wp_.
61
What does the wp_posts table store?
Information about posts, pages, and custom post types (each row = one post).
62
What does the wp_postmeta table store?
Additional information about each post (post meta, or custom fields).
63
What does the wp_comments table store?
Information about comments on posts and pages (each row = one comment).
64
What does the wp_commentmeta table store?
Additional information about each comment.
65
What does the wp_users table store?
Information about website users (each row = one user).
66
What does the wp_usermeta table store?
Additional information about each user.
67
What is the WordPress Database API?
A set of functions for interacting with WordPress database tables.
68
What are the three common functions to interact with a database table?
insert, update, delete.
69
What is the function to insert a post?
wp_insert_post.
70
What is the function to update a post?
wp_update_post.
71
What is the function to delete a post?
wp_delete_post.
72
What function fetches multiple posts?
get_posts.
73
What function fetches a single post?
get_post.
74
How do meta functions for posts typically look?
add_post_meta, update_post_meta, delete_post_meta.
75
What does the wp_terms table store?
Information about terms (categories, tags, or other terms).
76
What determines whether a term is a category or a tag?
The taxonomy associated with it, stored in wp_term_taxonomy.
77
What does the wp_term_taxonomy table store?
The taxonomy information (category, tag, custom taxonomy).
78
What does the wp_term_relationships table store?
The relationships between terms and posts/pages/custom post types.
79
What does the wp_termmeta table store?
Additional information about each term.
80
How can you find functions to interact with terms and taxonomies?
By searching the WordPress Code Reference for "term" or "taxonomy".
81
What does the wp_options table store?
Site settings (each row = one option), such as site URL, tagline, active theme, active plugins.
82
How is data stored in wp_options?
In key-value pairs.
83
What type of data can also be stored in wp_options?
Serialized data (a string that stores arrays or objects).
84
What is an example of serialized data in wp_options?
The list of active plugins.
85
What API is used to interact with wp_options?
The Options API.
86
What are common Options API functions?
add_option, update_option, delete_option.
87
What does the wp_links table store?
Information about website links (legacy feature; removed in WordPress 3.5 but kept for compatibility).
88
Why is understanding the WordPress database useful?
It helps you better understand how WordPress works when developing with it.
89
What are Permalinks in WordPress?
Clean, human-readable URLs used to display content.
90
What is a Directory Index file?
The file executed when a user browses to the root URL of a site.
91
How can WordPress display different types of content via the same Directory Index file?
Using Permalinks.
92
What is a query string in a URL?
A way to pass data to the server via the URL (e.g. ?p=1).
93
In PHP, how is a query string value accessed?
Using the $_GET super global (e.g. $_GET['p']).
94
What is the difference between a query string URL and a permalink?
A permalink does not use a query string and is more human-readable.
95
What server feature enables Permalinks?
URL rewriting.
96
What does URL rewriting do?
Maps clean URLs to internal server requests.
97
Where in WordPress do you configure Permalinks?
In the WordPress dashboard under Settings > Permalinks.
98
What is the default permalink structure called?
Plain (uses query strings).
99
What happens when you choose a permalink structure other than Plain?
The server is configured to expect clean URLs and WordPress stores the structure in the database.
100
How does WordPress handle Permalink mapping?
It maps the URL structure to the appropriate content and displays it.
101
How are Permalinks implemented on Apache?
Via rewrite rules in the .htaccess file.
102
What Apache module is required for Permalinks?
mod_rewrite.
103
What is an example of a rewrite rule in .htaccess?
RewriteRule . /index.php [L].
104
How are Permalinks implemented on Nginx?
Using a location directive in the server block configuration.
105
What is an example Nginx location directive for Permalinks?
try_files $uri $uri/ /index.php?$args;
106
Why does Nginx not use .htaccess?
Nginx does not support per-directory configuration like Apache.
107
What happens when you add internal links in WordPress after setting Permalinks?
WordPress automatically generates URLs that match the chosen Permalink structure.
108
What are the two types of requests on a WordPress site?
Front-end requests and admin requests.
109
What file handles most front-end requests?
index.php in the root directory.
110
What constant is set in index.php for front-end requests?
WP_USE_THEMES.
111
What is the first file required by index.php?
wp-blog-header.php.
112
What does the require statement do in PHP?
It includes the contents of the file and stops execution with an error if the file is not found.
113
What is the difference between require and require_once?
require_once only includes the file if it hasn't already been included.
114
What does wp-blog-header.php do?
It sets up the WordPress environment by requiring wp-load.php.
115
What is the purpose of wp-load.php?
Defines ABSPATH, sets error reporting, loads wp-config.php, or redirects to setup-config.php.
116
What is ABSPATH used for?
It helps plugins check if they are running in a WordPress environment.
117
Why move wp-config.php outside the WordPress directory?
For security — prevents direct access by malicious users.
118
What does wp-config.php define?
Database constants, debugging constants, and other required constants.
119
Which file does wp-config.php require?
wp-settings.php.
120
What is wp-settings.php responsible for?
Setting up the complete WordPress environment.
121
List some key tasks wp-settings.php performs.
Loads version info, required files, constants, plugins, core functionality, themes, locales, query objects.
122
What is the wp() function?
It determines what needs to be rendered and fetches relevant data from the database.
123
Where is the wp() function called?
In wp-blog-header.php after WordPress environment setup.
124
Where is the $wp object defined?
In wp-includes/class-wp.php.
125
What does $wp->main() do?
Calls init(), sets up the current user, parses the request, matches rewrite rules, builds query variables.
126
What does parse_request() do?
Parses request and builds $query_vars array.
127
What happens if no rewrite rules match?
The $query_vars array is built from the query string.
128
Which methods are called after parse_request()?
query_posts(), handle_404(), register_globals().
129
What does query_posts() do?
Builds and runs the main query using WP_Query.
130
Where is WP_Query defined?
In wp-includes/class-wp-query.php.
131
What method does WP_Query use to fetch posts?
get_posts().
132
What does handle_404() do?
Sets HTTP 404 headers if no matching content is found.
133
What does register_globals() do?
Registers query variables as global variables.
134
What does send_headers() do?
Sends HTTP headers to the browser.
135
What hook is triggered at the end of wp()?
The wp action hook.
136
What is template-loader.php used for?
It finds and loads the correct template based on the visitor’s URL.
137
What happens before the template is loaded?
The template_redirect action fires.
138
What do is_robots(), is_favicon(), is_feed(), is_trackback() check?
If the request is for robots.txt, favicon.ico, an RSS feed, or a trackback.
139
What happens if WP_USE_THEMES is true?
WordPress loops through template conditionals and loads the correct template file.
140
What filter can modify the template path before loading?
template_include.
141
How is the template file included?
Using include (not require), so the page can still render even if the template is missing.
142
What directory handles the WordPress admin interface?
The wp-admin directory.
143
How do admin requests differ from front-end requests?
Different PHP files are executed depending on the functionality used; permalinks are not used — query strings are used instead.
144
What is the default URL of the admin dashboard?
https://example.com/wp-admin/
145
What file is loaded for the admin dashboard?
index.php in the wp-admin directory.
146
What file is loaded when viewing posts in the admin?
edit.php in the wp-admin directory.
147
What does the URL https://example.com/wp-admin/post.php?post=1&action=edit do?
Loads post.php and passes query string variables for post ID and action.
148
How is data passed in admin URLs?
Using query strings.
149
What file is commonly included in admin requests?
wp-admin/admin.php.
150
What does wp-admin/admin.php do?
Sets up the WordPress environment for admin requests.
151
What admin-specific tasks does admin.php handle?
Sets admin-specific constants, includes wp-load.php, wp-config.php, and wp-settings.php.
152
Does wp-load.php behave differently in admin requests?
No, it behaves the same — loads WordPress environment and config settings.
153
What happens after loading the WordPress environment in an admin request?
The file loads internal functionality specific to that admin section.
154
Where is the WordPress Dashboard API located?
wp-admin/includes/dashboard.php.
155
What does the Dashboard API do?
Sets up content and variables for the Dashboard page.
156
What file is used to set up the admin header?
wp-admin/admin-header.php.
157
What does admin-header.php handle?
Sets up and renders the admin header and admin menu.
158
What happens after rendering the admin header?
The content for the specific admin page is generated and rendered.
159
What file is used to set up the admin footer?
wp-admin/admin-footer.php.
160
What does admin-footer.php handle?
Sets up and renders the footer of the admin interface.
161
What does it mean to develop with security in mind?
Writing code that not only works, but avoids introducing security vulnerabilities.
162
Why is secure development important in WordPress?
Insecure plugins/themes can lead to compromised websites.
163
What is the key mindset when writing secure code?
Assume all data (user input, API responses, even database data) is untrusted.
164
Where should you learn more about secure development in WordPress?
The WordPress Developer Handbook: https://developer.wordpress.org/apis/security/
165
What should you rely on for input handling instead of writing your own functions?
WordPress APIs for sanitizing, validating, and escaping data.
166
At what stage should security be considered during development?
At every stage — it's part of the entire development process.
167
Where do most security vulnerabilities occur?
At the PHP layer on the server.
168
What does sanitizing input mean?
Cleaning user input to make it safe for use (e.g., stripping tags, special characters).
169
What is the danger of not sanitizing inputs before inserting into the database?
It opens the site to SQL injection attacks.
170
What are WordPress functions to sanitize name and email fields?
sanitize_text_field() and sanitize_email().
171
What is a best practice when sanitizing data?
Sanitize data as early as possible.
172
What does validating data mean?
Checking input against a defined pattern to ensure it's correct.
173
Why should even admin input or database data be validated?
Admins can make mistakes and databases can be modified externally.
174
What is a safe way to ensure an input is an integer in PHP?
Cast it using (int).
175
What should you do if a casted integer equals 0?
Handle it early as a possible invalid value.
176
When should you validate data?
As early as possible.
177
What does escaping output mean?
Making sure any data output to the browser is safe.
178
What WordPress function can escape HTML output?
esc_html().
179
What is a best practice for escaping output?
Escape as late as possible.
180
How can you escape numeric IDs safely?
Cast them to (int).
181
Why should you check if a request is valid?
To ensure it comes from a trusted source and not a malicious actor.
182
What is a nonce in WordPress?
A one-time-use token used to verify request authenticity.
183
How do you generate a nonce in a form?
Use wp_nonce_field().
184
How do you verify a nonce after form submission?
Use wp_verify_nonce().
185
What happens if nonce verification fails?
Redirect or exit early to prevent processing the request.
186
What should be used to restrict features to specific users?
WordPress User Roles and Capabilities.
187
How do you check if a user has a certain capability?
Use current_user_can().
188
What capability is commonly used for administrator-only access?
manage_options.
189
Why should you use current_user_can() even in protected functions?
To enforce server-side permission checks in case frontend protection fails.
190
Where can you learn more about user permissions in WordPress?
In the WordPress Developer Handbook under User Roles and Capabilities.
191
What should you always assume about input data in secure development?
That it is untrusted and must be validated and sanitized.
192
What is the goal of this lesson?
To apply WordPress security principles by fixing a vulnerable form submission plugin.
193
What is SQL Injection?
A vulnerability where untrusted input is used in SQL queries without proper sanitization, allowing malicious SQL execution.
194
Where was the SQL Injection found in the example plugin?
In the wp_learn_maybe_process_form and wp_learn_delete_form_submission functions.
195
How do you prevent SQL Injection in WordPress?
Sanitize input and use $wpdb->insert(), $wpdb->delete(), or $wpdb->prepare().
196
Why is using $wpdb->insert() more secure than writing raw SQL?
It automatically prepares the query and escapes input data safely.
197
What is Cross-Site Scripting (XSS)?
A vulnerability where attackers inject JavaScript or HTML into a web page to execute in a user’s browser.
198
How do you prevent XSS in WordPress?
Escape all output using appropriate escaping functions.
199
Which function should be used to escape HTML element content?
esc_html().
200
Which function should be used to escape HTML attribute values?
esc_attr().
201
How was XSS possible in the shortcode output?
The class attribute was echoed without escaping.
202
How was XSS possible in the admin list table?
The name, email, and ID fields were output without escaping.
203
How can numeric values like IDs be escaped?
By casting them as integers (e.g. (int)$id).
204
What is Cross-Site Request Forgery (CSRF)?
A type of attack where an unauthorized command is transmitted from a user that the web app trusts.
205
How do WordPress nonces help prevent CSRF?
They verify the request is coming from a trusted source.
206
How do you add a nonce field to a form?
Use wp_nonce_field().
207
How do you verify a nonce after a form is submitted?
Use wp_verify_nonce().
208
What happens if wp_verify_nonce() fails?
You should redirect or exit early to prevent the action.
209
What WordPress function is used to verify a nonce in an Ajax request?
check_ajax_referer().
210
How do you pass a nonce to JavaScript?
Use wp_create_nonce() and pass it to wp_localize_script().
211
What is Broken Access Control (BAC)?
When users can access functions or data they should not have permission to access.
212
How do you prevent BAC in WordPress?
Use current_user_can() to verify the user’s capability before executing restricted code.
213
What capability should you check to restrict actions to admins?
manage_options.
214
What is the correct order of security checks?
First check for CSRF, then check for user permissions (access control).
215
What is an Open Redirect vulnerability?
When untrusted input is used in a redirect, potentially sending users to malicious websites.
216
How do you prevent Open Redirects in WordPress?
Use wp_safe_redirect() instead of wp_redirect().
217
What does wp_safe_redirect() do?
It ensures the redirect location is an allowed host and prevents external redirects.
218
Where can you read more about fixing common WordPress vulnerabilities?
The WordPress Developer Handbook – Security: Common Vulnerabilities section.
219
What is the purpose of this lesson?
To introduce tools for detecting security vulnerabilities in WordPress plugins and themes.
220
What plugin checks if your plugin meets WordPress.org standards, including security?
Plugin Check.
221
Where do you find Plugin Check in the WordPress admin dashboard?
Under Tools > Plugin Check.
222
What plugin is used to check themes for issues and security?
Theme Check.
223
Where do you find Theme Check in the dashboard?
Under Appearance > Theme Check.
224
What tool can you use from the command line to check code against WordPress coding and security standards?
PHP_CodeSniffer with WordPress Coding Standards.
225
What must be installed to use PHP_CodeSniffer with WordPress standards?
Composer and PHP (CLI).
226
What is Composer?
A dependency manager for PHP projects.
227
How can you test if PHP CLI is working?
Run `php -v` in the terminal.
228
What command initializes a Composer project in your plugin/theme folder?
composer init.
229
What command installs WordPress Coding Standards?
composer require --dev wp-coding-standards/wpcs:"^3.0"
230
How do you run PHP_CodeSniffer with the WordPress standard?
vendor/bin/phpcs wp-learn-plugin-security.php --standard=WordPress
231
What does PHP_CodeSniffer do?
It scans PHP files for violations of WordPress coding and security standards.
232
Which code editor supports PHP_CodeSniffer via extensions?
Visual Studio Code (and others).
233
What is a popular extension for Visual Studio Code to run PHP_CodeSniffer?
phpcs.
234
What is SonarLint?
A free tool that scans code for vulnerabilities in real time.
235
What editors support SonarLint?
Visual Studio Code, JetBrains editors, and Eclipse.
236
How does SonarLint help developers?
It highlights security and quality issues in your code as you write it.
237
What is OWASP?
The Open Web Application Security Project — a nonprofit focused on improving software security.
238
What is the OWASP Top 10?
A list of the ten most critical security risks to web applications.
239
Why is it important to follow the OWASP Top 10?
It helps you stay up-to-date with modern security risks and best practices.
240
Is SonarLint free?
Yes, for open-source projects. Paid for private repo analysis.
241
What kind of issues can Plugin Check and Theme Check detect?
Code quality, standards violations, and potential security vulnerabilities.
242
What are WordPress blocks used for?
Representing and storing content in the Post/Page editors and Site Editor.
243
How are blocks represented in the post content?
As special HTML comments with optional JSON data and HTML inside.
244
What does a paragraph block look like in code view?

Text here

245
Where are block attributes (like background color) stored?
Inside the opening block comment as a JSON object.
246
What happens to JSON block attributes when rendered?
WordPress converts them to appropriate HTML attributes or CSS classes.
247
What tools are needed to develop WordPress blocks?
A code editor, a local WordPress install, a terminal, and Node.js with npm.
248
Why is the terminal necessary for block development?
It allows you to run commands like npm installs and build scripts.
249
What is the default terminal on macOS and Linux called?
Terminal.
250
What terminal is recommended on Windows?
PowerShell (preferably the latest from Microsoft's site).
251
What is Node.js used for in block development?
It enables use of JavaScript tools like React and build tools.
252
What is npm?
Node Package Manager — it comes bundled with Node.js and manages JavaScript packages.
253
What is nvm?
Node Version Manager — a tool for managing multiple Node.js versions.
254
Why use nvm instead of installing Node.js directly?
It lets you easily switch between Node.js versions across projects.
255
How do you install nvm on macOS/Linux?
Run the install script from the nvm GitHub repo using curl.
256
How do you install nvm on Windows?
Use PowerShell with Chocolatey CLI and run `choco install -y nvm`.
257
How do you install the current Node.js LTS version with nvm?
nvm install --lts
258
How do you set the active Node.js version in your terminal session?
Use `nvm use 20` or `nvm use --lts`
259
How can you make a Node.js version the default for all terminal sessions?
Use `nvm alias default 20`
260
How do you check the currently active versions of Node.js and npm?
Run `node -v` and `npm -v`
261
Why might you need multiple versions of Node.js?
Different projects may depend on different Node.js versions.
262
Where can you find official documentation about blocks and block development?
The WordPress Developer Handbook under "Block Editor".
263
Which section should new developers read first in the Block Editor docs?
"Fundamentals of Block Development"
264
What is the file format used to define block settings in post content?
JSON (inside the block comment)
265
What frontend framework powers WordPress block development?
React.
266
What is create-block?
A command-line tool that scaffolds a new block plugin following WordPress block development best practices.
267
What does "scaffolding" mean in software development?
Creating the basic project structure and files needed to start building.
268
Why is it recommended to create blocks as plugins?
Blocks aren't allowed in themes on WordPress.org; plugins provide better structure and compatibility.
269
What are the features of the Copyright Date Block example?
Displays “Copyright © [start year] – [current year]”, allows alignment and start year changes, and always applies specific CSS styles.
270
What command is used to scaffold a new block plugin?
npx @wordpress/create-block@latest your-plugin-slug
271
Where should you run the create-block command?
Inside the wp-content/plugins directory of your local WordPress install.
272
What does the create-block tool generate?
A full block plugin with folders, files, scripts, and build tooling.
273
What are the three main directories in a scaffolded block plugin?
build, node_modules, and src.
274
What is the build directory used for?
Contains compiled (bundled) code that runs in the editor and frontend — no manual edits needed.
275
What is the node_modules directory used for?
Stores JavaScript dependencies used during local development.
276
Where do you write your block’s code?
In the src directory.
277
What does the copyright-date-block.php file do?
It’s the main plugin file that registers the block with WordPress.
278
Which function is used to register the block?
register_block_type()
279
Which action hook is used to initialize the block?
init
280
What is the package.json file for?
Defines project metadata, scripts, and dependencies for npm.
281
Which script compiles code into the build directory?
build
282
Which script starts a development server and watches for changes?
start
283
What is the purpose of package-lock.json?
It locks dependency versions used in the project — not typically edited manually.
284
What is block.json used for?
Stores block metadata like name, title, icon, and source files.
285
What is edit.js for?
Defines the Edit() component rendered in the block editor.
286
What is save.js for?
Exports the save() function that controls how the block appears on the frontend.
287
What is index.js for?
The entry point that runs registerBlockType and loads the block.
288
What is editor.scss for?
Defines block styles for the block editor (optional).
289
What is style.scss for?
Defines styles shared by the frontend and editor (can override with editor.scss).
290
What is view.js for?
Adds extra JavaScript for frontend behavior (optional).
291
What is Webpack’s role in block development?
It bundles block code into a format compatible with browsers.
292
What does the @wordpress/scripts package do?
Provides tools and scripts for building, linting, and bundling block code.
293
What does the index.asset.php file do?
Stores metadata about the compiled JavaScript file for dependency loading.
294
Where can you learn more about create-block?
In the Block Editor Handbook under the create-block package reference.
295
What is the first cleanup step when starting to build your block?
Delete `view.js` and remove the `viewScript` property from `block.json`.
296
What can you update in the main plugin file (PHP)?
The @package annotation and simplify the hook function for `register_block_type`.
297
How should the `add_action()` function look after cleanup?
add_action( 'init', 'copyright_date_copyright_date_block_block_init' );
298
What function registers the block in PHP?
register_block_type( __DIR__ . '/build/copyright-date-block' );
299
What does `register_block_type()` use to register the block?
Metadata from `block.json`.
300
Which properties in `block.json` should be customized?
`name`, `icon`, and `description`.
301
What icon value is recommended for the Copyright Date Block?
calendar
302
What does the `supports: { "html": false }` line do?
Disables the ability to edit the block’s HTML manually in the editor.
303
What is the purpose of `block.json`?
Defines block metadata such as name, icon, description, and script/style paths.
304
What does the `index.js` file do?
Imports dependencies and registers the block using `registerBlockType()`.
305
What is imported from `@wordpress/blocks` in `index.js`?
registerBlockType
306
What does the `edit` property in `registerBlockType()` reference?
The React Edit component imported from `edit.js`.
307
What does the `save` property in `registerBlockType()` reference?
The function imported from `save.js` to define the frontend markup.
308
What is the purpose of importing `style.scss` in `index.js`?
To load the block’s styles for both frontend and editor.
309
How do you manually build the block after editing code?
Run `npm run build` in the terminal.
310
What does `npm run build` do?
Compiles the `src` files into the `build` directory.
311
What does `npm run start` do?
Starts a dev server that watches for changes and rebuilds automatically.
312
What happens if the `build` directory does not exist when you run `npm run build`?
It gets created automatically.
313
Why is `npm run start` useful during development?
It automatically rebuilds your block code as you make changes.
314
After building, how do you check your block in WordPress?
Open the editor, create a post, and add your block via the block inserter.
315
Where can you learn more about block metadata fields?
In the “Metadata in block.json” section of the Block Editor Handbook.
316
Where can you learn more about the development platform?
In the “Development platform” and “Working with JavaScript for the Block Editor” sections of the Block Editor Handbook.
317
Where is the block’s editor behavior defined?
edit.js using the Edit component
318
What does the Edit component return in React?
A JSX structure representing the block's appearance in the editor
319
What does JSX stand for?
JavaScript XML – a syntax extension that looks like HTML but is actually JavaScript
320
What is important about JSX components in React?
They must return a single parent container element
321
What does the `useBlockProps()` function do?
Returns props that should be applied to the block’s wrapper element
322
What does the `...` (spread syntax) do in JSX?
Expands the key-value pairs returned by useBlockProps as HTML attributes
323
What does the `__()` function do in WordPress block development?
Makes strings translatable (Internationalization support)
324
Why is only the word "Copyright" wrapped in `__()`?
Only "Copyright" needs to be translated; the years and symbol do not
325
How do you get the current year in JavaScript?
new Date().getFullYear().toString()
326
How should the Edit component render the copyright block?

{ __('Copyright', 'copyright-date-block') } © 2019 - { currentYear }

327
Where is the block’s frontend rendering defined?
In the save.js file, via the `save()` function
328
What does `useBlockProps.save()` do?
Returns only frontend-relevant block properties
329
How should the save function mirror the Edit component?
Use the same structure and dynamic year to match frontend and editor appearance
330
How do you trigger the build process after changes?
Run `npm run build` or use `npm run start` for auto-building
331
What does the save function output get stored as?
As HTML in the `post_content` field in the database
332
Why might JSX code be written on multiple lines?
For better readability, especially in complex structures
333
After building, how do you preview your block?
Add it to a post and use the Preview button in the WordPress editor
334
Where can you learn more about Edit and Save functions?
In the Block Editor Handbook’s Edit and Save reference guide
335
What are block attributes in WordPress?
Properties of a block that control its behavior and appearance
336
Where are block attributes defined?
In the `block.json` file under the "attributes" key
337
How do you define a starting year attribute with a default of 2000?
"attributes": { "startingYear": { "type": "string", "default": "2000" } }
338
How do you access block attributes in the Edit function?
Destructure `attributes` from `props` and access `attributes.startingYear`
339
What is object destructuring in JavaScript?
A way to extract properties from an object into variables
340
What happens if save output differs from the saved content in the DB?
Block validation error occurs: “This block contains unexpected or invalid content”
341
How can you recover a block after a validation error?
Click “Attempt Block Recovery” to re-render and re-save
342
What is the InspectorControls component used for?
To add controls to the block's settings sidebar
343
What package provides `InspectorControls`?
@wordpress/block-editor
344
What components are used to create a settings panel?
`InspectorControls`, `PanelBody`, and `TextControl`
345
What is the TextControl component?
A text input field used to allow users to enter string values
346
Which package provides `PanelBody` and `TextControl`?
@wordpress/components
347
What must all React components return?
A single parent container (can be a `
` or a Fragment `<>...`)
348
Why use a React Fragment in Edit instead of a div?
To avoid adding unnecessary markup when only a single HTML element is needed
349
What does the `value` prop on TextControl do?
Sets the input field’s current value
350
What does the `onChange` prop on TextControl do?
Handles the event when the user changes the input
351
What function is used to update block attributes?
`setAttributes()`
352
How do you update `startingYear` using setAttributes?
onChange={ (newStartingYear) => { setAttributes({ startingYear: newStartingYear }); } }
353
Where can you see the attribute stored when switching to Code Editor?
In the block wrapper as JSON
354
Why might the development server crash when editing block.json?
Because it watches files and needs to be restarted when schema changes
355
What handbook page is recommended for more on attributes?
The Attributes guide in the Block Editor Handbook
356
What is the purpose of Block Supports in WordPress blocks?
To declare support for common block features like alignment, color, typography, etc.
357
Where are Block Supports defined?
In the `supports` property of the `block.json` file.
358
How do you enable alignment support in a block?
"supports": { "html": false, "align": true }
359
What effect does enabling "align" support have?
Adds alignment options to the block in the Editor (left, center, right, wide, full).
360
How do you enable additional block supports?
Add more properties under "supports" in `block.json`.
361
What are the two style files used in block development?
`style.scss` and `editor.scss`.
362
What is the purpose of style.scss?
Defines styles applied to both the editor and the front end.
363
What is the purpose of editor.scss?
Defines styles applied only in the editor.
364
What is Sass/SCSS?
A CSS preprocessor syntax that compiles into regular CSS; you can write plain CSS in it too.
365
Where should styles go if they should apply everywhere (editor + front end)?
In the `style.scss` file.
366
What issue might arise from the scaffolded CSS class name?
It may not match the auto-generated block class name based on the block’s final name.
367
How is the block class name generated?
Using the block name from `block.json`, prefixed with `wp-block-`, replacing slashes with dashes.
368
What should you update the CSS class to in `style.scss` if your block name is "copyright-date/copyright-date-block"?
.wp-block-copyright-date-copyright-date-block
369
How do you add a border and padding to a block in `style.scss`?
.wp-block-copyright-date-copyright-date-block { border: 1px solid #111111; padding: 5px; }
370
When should you delete the `editor.scss` file?
When no editor-only styles are needed.
371
What else must be removed if you delete `editor.scss`?
- The `editorStyle` property in `block.json` - The import statement in `edit.js`.
372
What might happen after deleting editor.scss or modifying styles?
The dev server may crash — restart it if necessary.
373
Where can you preview the effects of style changes?
In both the block editor and the front end.
374
Why is it helpful to distinguish between editable and fixed styles?
So users can control appearance where needed, and fixed design elements stay consistent.
375
Where can you learn more about block supports?
The "Supports" page in the Block Editor Handbook.
376
What are the two types of WordPress blocks based on rendering behavior?
Static and dynamic blocks
377
What is a static block?
A block that saves its output via the `save()` function and does not change after being saved
378
Give an example use case for a static block
A quote, testimonial, or any content that doesn’t need to update automatically
379
What is a dynamic block?
A block that renders its content via PHP at runtime, rather than saving HTML to the database
380
Why would you use a dynamic block for the Copyright Date Block?
So it automatically displays the current year without needing to edit and re-save posts
381
How do you specify that a block should render dynamically?
Add a "render" property to `block.json`, e.g., "render": "file:./render.php"
382
What does the `render.php` file do?
Contains PHP logic to output the block’s content dynamically on the front end
383
What function retrieves the wrapper attributes for a dynamic block in PHP?
`get_block_wrapper_attributes()`
384
What variable holds block attributes in a dynamic block’s render file?
`$attributes`
385
How do you get the current year in PHP?
`date('Y')`
386
What HTML tag is typically used to render dynamic block output in this example?
A `

` tag with echoed PHP values inside

387
What should you remove when converting a block to dynamic?
- `save.js` file - `save` property from `registerBlockType` - Import of the `save` function
388
What happens to the block output in the post’s `post_content` for a dynamic block?
It’s not saved — rendering occurs at runtime via PHP
389
What happens if you change the year value in the dynamic block’s PHP?
The front-end output updates automatically without needing to resave posts
390
What JavaScript function is equivalent to `get_block_wrapper_attributes()` in PHP?
`useBlockProps()`
391
Why might the code editor show no content for a dynamic block?
Because dynamic blocks don’t store their rendered output in `post_content`
392
Where can you learn more about static vs dynamic blocks?
In the “Static or Dynamic rendering of a block” section of the Block Editor Handbook
393
What is a WordPress plugin?
A package of code that can be installed on a WordPress website to add new features or functionality.
394
What is the main difference between a theme and a plugin in WordPress?
Themes control the look and feel, while plugins extend functionality.
395
Why might you add functionality to a plugin rather than a theme’s functions.php file?
Because plugins can be activated/deactivated independently and reused across multiple sites.
396
Where are WordPress plugins stored?
Inside the wp-content/plugins directory.
397
What is the minimum requirement for a valid WordPress plugin?
One main PHP file with a specifically formatted comment block (DocBlock) at the top.
398
What is the Hello Dolly plugin an example of?
A single-file plugin.
399
What is Akismet an example of?
A multi-file plugin.
400
What is the role of the main file in a multi-file plugin like Akismet?
It handles the loading of all other required files.
401
Where can you find official documentation on WordPress plugin development?
The WordPress Plugin Developer Handbook at developer.wordpress.org (under the “Plugins” section).
402
How many plugins are available in the WordPress plugin directory?
Over 50,000 plugins.
403
What are the minimum requirements for a valid WordPress plugin?
At least one PHP file with an opening PHP tag and a Plugin Header comment block containing the plugin name.
404
Where do you place plugin files in a WordPress installation?
In the wp-content/plugins directory.
405
What is a Plugin Header in WordPress?
A PHP comment block that defines metadata about the plugin, starting with the Plugin Name.
406
What does the following comment block represent in a plugin file? `/** Plugin Name: Example Plugin */`
The Plugin Header, identifying the plugin's name.
407
How does WordPress identify and store active plugins?
By their slug (filename or directory/filename) in a serialized array in the wp_options table under 'active_plugins'.
408
What happens if you move a plugin file into a new directory?
The plugin slug changes and it must be reactivated, as the path has changed.
409
What SQL query can be used to view active plugins?
SELECT * FROM `wp_options` WHERE `option_name` LIKE 'active_plugins'
410
What are two commonly recommended additional Plugin Header fields?
Description and Version.
411
What is the purpose of the `ABSPATH` check in a plugin file?
To ensure plugin code runs only in WordPress and not when accessed directly via URL.
412
What happens if someone accesses a plugin file directly and there is no `ABSPATH` check?
The plugin code may run outside of WordPress, posing a security risk.
413
What is a custom post type in WordPress?
A content type created using the WordPress Post API to store specific types of content beyond posts and pages.
414
What core function is used to register a custom post type?
register_post_type()
415
What two parameters does register_post_type accept?
The custom post type name (string) and an array of arguments (array).
416
What built-in WordPress post type is an example of a custom post type?
Page
417
What does the 'public' argument do when registering a custom post type?
Determines whether the post type is visible to all users (front and back end).
418
Why is 'show_in_rest' often set to true in modern WordPress custom post types?
To enable support for the block editor and REST API.
419
What hook should you use to register a custom post type?
init
420
Why is it important to prefix custom functions in plugins?
To avoid naming conflicts with other plugins or themes.
421
What is the purpose of the 'supports' argument when registering a post type?
It defines which editor features (title, editor, thumbnail, etc.) the post type supports.
422
What might be a performance concern when using custom post types?
Registering too many can slow down every page load since registration runs on every request.
423
What is a taxonomy in WordPress?
A system for grouping related content.
424
What are the two default taxonomies in WordPress?
Categories and Tags.
425
Why create custom taxonomies?
To group content in ways that are specific to your plugin or custom post type, e.g. genres for books.
426
Which function is used to register a custom taxonomy?
register_taxonomy()
427
What parameters does register_taxonomy require?
The taxonomy name, the associated post type, and an array of arguments.
428
Where should register_taxonomy be hooked into?
init
429
What argument makes a custom taxonomy hierarchical, like categories?
'hierarchical' => true
430
What does the 'rewrite' argument do in register_taxonomy?
Controls the permalink slug for the taxonomy terms.
431
What does 'show_in_rest' => true enable for a custom taxonomy?
REST API and block editor support.
432
Where will the custom taxonomy appear in the admin once registered?
In the admin menu and post editor for the associated post type.
433
What is post metadata in WordPress?
Additional information stored about a post as key-value pairs.
434
Where is post metadata stored in the database?
In the postmeta table.
435
What function adds metadata to a post?
add_post_meta()
436
What function retrieves metadata from a post?
get_post_meta()
437
What function updates metadata for a post?
update_post_meta()
438
What function deletes metadata from a post?
delete_post_meta()
439
What must be enabled in the custom post type to show the Custom Fields panel?
Support for 'custom-fields' in the supports argument.
440
How do you enable the Custom Fields panel in the block editor?
Preferences → Panels → Toggle on "Custom Fields".
441
What filter can be used to pre-populate field names in the Custom Fields panel?
postmeta_form_keys
442
What does the postmeta_form_keys filter allow you to do?
Add predefined meta keys to the Custom Fields panel.
443
How can you let users easily enter an ISBN for books in the Custom Fields panel?
Use the postmeta_form_keys filter to add 'isbn' for book post types.
444
What is another method for entering metadata via the admin besides the Custom Fields panel?
Custom Meta Boxes.
445
What is "enqueuing" in WordPress?
A method for properly adding CSS or JS files to a WordPress site.
446
Which hook is used to enqueue scripts and styles on the front end?
wp_enqueue_scripts
447
What function is used to enqueue a CSS file?
wp_enqueue_style()
448
What function is used to enqueue a JavaScript file?
wp_enqueue_script()
449
What helper function helps generate plugin-relative paths?
plugins_url()
450
Where should plugin CSS or JS files be enqueued from?
Inside a callback hooked to wp_enqueue_scripts or admin_enqueue_scripts
451
What is the purpose of the handle in wp_enqueue_style/wp_enqueue_script?
A unique name used to identify the script or style.
452
What function checks if a single post of a specific post type is being viewed?
is_singular( 'post_type' )
453
Which hook is used to enqueue styles/scripts in the admin dashboard?
admin_enqueue_scripts
454
Why is selective enqueuing recommended?
To avoid loading scripts/styles unnecessarily and reduce page load time.
455
How can you restrict enqueuing to only single book pages?
Check if is_singular( 'book' ) is true before enqueuing.
456
What tag does WordPress output for enqueued styles?
tag with the handle as the id and src as the href.
457
What tag does WordPress output for enqueued scripts?