WordPress Case Studies & Practical Application 5 — Questions and Answers
Question 1: A developer is asked to add custom fields to WordPress user profiles that appear in the front-end account dashboard. What is the correct hook to add fields to the admin user profile?
- add_action('user_register', ...)
- add_action('show_user_profile', ...) and add_action('edit_user_profile', ...) (Correct answer)
- add_action('wp_footer', ...)
- add_filter('the_content', ...)
Correct answer: add_action('show_user_profile', ...) and add_action('edit_user_profile', ...)
show_user_profile fires on the current user's profile page and edit_user_profile fires on another user's profile, covering both cases.
Question 2: A media company's WordPress site has 200,000 posts. The wp_options table's autoloaded data is 15MB, causing slow admin loads. What is the recommended fix?
- Increase the PHP memory limit to 512MB
- Audit and disable autoload on non-critical options; delete orphaned plugin options (Correct answer)
- Move the site to a faster server
- Enable object caching with Redis or Memcached
Correct answer: Audit and disable autoload on non-critical options; delete orphaned plugin options
WordPress loads all autoloaded options on every request; pruning orphaned plugin data and disabling unnecessary autoload flags directly reduces this overhead.
Question 3: You are setting up a WordPress site that must load different content for visitors from the US versus the UK without using two separate sites. What is the best approach?
- Create duplicate pages with -us and -uk suffixes and link to them manually
- Use a geolocation plugin or Cloudflare Workers to detect visitor location and serve region-specific content dynamically (Correct answer)
- Set the site language to auto-detect in wp-config.php
- Use hreflang tags to redirect users to different pages
Correct answer: Use a geolocation plugin or Cloudflare Workers to detect visitor location and serve region-specific content dynamically
Geolocation at the plugin or CDN/edge layer allows conditional content delivery without maintaining separate WordPress installs.
Question 4: A client's WordPress site was hacked and the attacker added a backdoor via a vulnerable plugin. After cleaning, what is the most important step to prevent reinfection?
- Change the database table prefix
- Update all plugins, themes, and WordPress core; reset all passwords; review file permissions (Correct answer)
- Disable XML-RPC
- Move WordPress to a subdirectory
Correct answer: Update all plugins, themes, and WordPress core; reset all passwords; review file permissions
The attack vector was an outdated plugin; fully patching everything and rotating credentials closes the original breach and limits lateral reuse.
Question 5: A WooCommerce store owner wants to offer a 10% discount automatically when a customer's cart total exceeds $100. No coupon code should be required. How is this configured?
- Create a coupon with a minimum spend rule and share it publicly
- Use WooCommerce's built-in Cart Discount via a Dynamic Pricing plugin, or write a woocommerce_cart_calculate_fees action hook (Correct answer)
- Edit the product prices to reflect the discount permanently
- Set a sale price on every product above $10
Correct answer: Use WooCommerce's built-in Cart Discount via a Dynamic Pricing plugin, or write a woocommerce_cart_calculate_fees action hook
Automatic cart-level discounts require either a dynamic pricing extension or a custom woocommerce_cart_calculate_fees hook since native WooCommerce coupons require manual entry.
Question 6: After a WordPress site migration, Google Search Console reports a spike in 'Soft 404' errors for paginated archive pages (/page/2/, /page/3/, etc.). What is the most likely cause?
- The robots.txt is blocking Googlebot from crawling paginated pages
- The new host redirects all paginated URLs to the homepage, returning a 200 status with homepage content (Correct answer)
- WordPress pagination was disabled in Settings > Reading
- The sitemap does not include paginated URLs
Correct answer: The new host redirects all paginated URLs to the homepage, returning a 200 status with homepage content
A server misconfiguration that sends all paginated requests to the homepage returns HTTP 200 but Google detects the content mismatch as a soft 404.
Question 7: A nonprofit's WordPress site must allow multiple staff members to edit the same page simultaneously without overwriting each other's changes. Which feature or plugin addresses this?
- Enable WordPress Multisite
- Use a collaborative editing plugin such as Undo and Co-Authors Plus, or integrate with Google Docs via a connector (Correct answer)
- Set all staff members as Administrators
- Enable WordPress's built-in post locking override
Correct answer: Use a collaborative editing plugin such as Undo and Co-Authors Plus, or integrate with Google Docs via a connector
WordPress's default post locking prevents simultaneous edits; a real-time collaboration plugin or external doc connector enables true concurrent editing.
A developer is asked to add custom fields to WordPress user profiles that appear in the front-end account dashboard.
What is the correct hook to add fields to the admin user profile?