WordPress Technology & Digital Applications 4 — Questions and Answers
Question 1: Which WordPress function outputs the title of the current post or page and is commonly used inside The Loop?
- get_the_title()
- the_title() (Correct answer)
- post_title()
- wp_title()
Correct answer: the_title()
the_title() echoes the current post's title directly, while get_the_title() returns it without outputting.
Question 2: What is the role of the .htaccess file in a WordPress installation on Apache servers?
- It stores WordPress database credentials
- It handles URL rewriting to enable pretty permalinks (Correct answer)
- It caches static assets for faster delivery
- It defines user permissions for the admin panel
Correct answer: It handles URL rewriting to enable pretty permalinks
The .htaccess file contains Apache rewrite rules that allow WordPress to convert database-driven URLs into human-readable permalinks.
Question 3: Which WordPress action hook is commonly used to run code during plugin activation?
- plugin_init
- register_activation_hook() (Correct answer)
- add_action('activate')
- wp_activate()
Correct answer: register_activation_hook()
register_activation_hook() lets developers run setup code—like creating database tables—when a plugin is activated for the first time.
Question 4: In WordPress, which template file is used as a fallback for all content types when no more-specific template exists?
- home.php
- content.php
- index.php (Correct answer)
- default.php
Correct answer: index.php
index.php is the ultimate fallback in the WordPress template hierarchy; every theme must include it.
Question 5: What is the primary advantage of using a child theme in WordPress?
- Child themes load faster than parent themes
- Customizations in a child theme survive parent theme updates (Correct answer)
- Child themes use less server memory
- Child themes automatically enable WooCommerce support
Correct answer: Customizations in a child theme survive parent theme updates
A child theme inherits the parent's styles and functionality while letting you override specific files, so your changes aren't overwritten when the parent theme updates.
Question 6: Which WordPress capability allows a user role to install and activate plugins?
- manage_options
- install_plugins (Correct answer)
- activate_plugins
- edit_plugins
Correct answer: install_plugins
The install_plugins capability controls whether a user role can upload and install new plugins from the admin dashboard.
Question 7: What does WP-CLI stand for and what is its main use?
- WordPress Content Layout Interface, used for designing themes
- WordPress Command Line Interface, used to manage WordPress from the terminal (Correct answer)
- WordPress Cache Loading Interface, used to purge caches
- WordPress Core Live Install, used to auto-update WordPress
Correct answer: WordPress Command Line Interface, used to manage WordPress from the terminal
WP-CLI is a command-line tool for managing WordPress installations without a browser, enabling tasks like updates, imports, and database operations via terminal.
Which WordPress function outputs the title of the current post or page and is commonly used inside The Loop?