WordPress

Administration & Content Management

Q1. Can we schedule post for the future publishing date? 
Answer: Yes. In the “Publish” settings of the editor, change the date from “Immediately” to a future date. WordPress uses its internal cron system (wp-cron.php) to publish the post automatically at that time.

Q2. What is the default storage engine while installing WordPress? 
Answer: The default storage engine is InnoDB. It is preferred over the older MyISAM because it supports row-level locking, better data integrity, and foreign key constraints.

Q3. Is there any database plugin for WP? 
Answer: Yes. Popular options include WP-Optimize (for cleaning), WP Migrate Lite (for migrations), and Advanced Database Cleaner (for removing orphaned metadata and revisions).

Q4. What are Permalinks and its types? 
Answer: Permalinks are the permanent URLs to your posts and pages. Types include Plain, Day and Name, Month and Name, Numeric, Post Name (the most SEO-friendly), and Custom Structure.

Q5. What is Category base and tag base? 
Answer: These are prefixes used in the URLs for archive pages. For example, if your category base is “topics,” a category URL would be site.com/topics/news/. These are managed under Settings > Permalinks.

Q6. What are Hooks and its types? 
Answer: Hooks are places where you can “hook” into the WordPress code to change how it works without editing core files. The two types are Actions (to perform a task at a specific point) and Filters (to modify data before it is displayed or saved).

Q7. Default number of tables in WP? 
Answer: A fresh installation of WordPress creates 12 default tables, such as wp_postswp_optionswp_users, and wp_comments.

Q8. How to hide top admin bar at front end? 
Answer: You can uncheck “Show Toolbar when viewing site” in the user profile settings, or add add_filter('show_admin_bar', '__return_false'); to the functions.php file.

Q9. What are template tags? 
Answer: These are PHP functions used in theme files to retrieve and display data from the database, such as the_title()the_content(), and the_author().

Q10. What are custom fields in WP? How to display it? 
Answer: Custom fields are metadata used to store extra information about a post. You can display them using the get_post_meta() function within the WordPress loop in your theme templates.

Q11. How to change default Post category and post type? 
Answer: The default category is changed in Settings > Writing. Changing the default post type is not a native setting but can be achieved via custom code using the pre_get_posts hook or custom routing.

Q12. How to change the length of default WP excerpt? 
Answer: By using the excerpt_length filter in the functions.phpfile and returning the specific integer (word count) you want to display.

Q13. What is Child theme? Why we use it? 
Answer: A child theme inherits the functionality of a parent theme. We use it to make customizations (CSS, PHP) that won’t be lost when the parent theme is updated by the developer.

Q14. Can we change “Error establishing database connection” message to more descriptive? 
Answer: Yes. Create a file named db-error.php in the wp-content directory. WordPress will load this file automatically if it fails to connect to the database.


Development & Theme Logic

Q15. What is the function required to create new taxonomy? 
Answer: The register_taxonomy() function is used to create custom taxonomies for any post type.

Q16. Is function.php file required in each theme? 
Answer: No. Only index.php and style.css are strictly required, but functions.php is almost always used to initialize theme features and enqueue assets.

Q17. Can we set individual password for each post? 
Answer: Yes. In the Status & Visibility settings of the post editor, click on “Public” and change it to “Password protected.”

Q18. WP built-in user roles count? 
Answer: There are 6 default roles: Super Admin, Administrator, Editor, Author, Contributor, and Subscriber.

Q19. What are WordPress hooks and how do you use them? 
Answer: Hooks are interfaces provided by WP Core. You use them by calling add_action() to trigger custom code or add_filter() to modify values passing through a specific point in the code.

Q20. How does WordPress handle its database? 
Answer: It uses MySQL or MariaDB. Developers interact with it through the $wpdb global object, which provides safe methods for querying the database without writing raw SQL that could be vulnerable to injection.

Q21. What are the best practices for optimizing database performance? 
Answer: Limit or disable post revisions, use object caching (Redis/Memcached), optimize tables via SQL, and avoid using the wp_options table to store massive amounts of temporary data.

Q22. How do you migrate a WordPress site to a different server or domain? 
Answer: Move the files via FTP/SSH, export the database via phpMyAdmin, and then use a search-and-replace tool (like WP-CLI) to update all serialized URLs in the database to the new domain.

Q23. How do you secure a WordPress website? 
Answer: Use strong passwords, 2FA, limit login attempts, use a Web Application Firewall (WAF), disable file editing in the dashboard, and keep all themes, plugins, and core files updated.

Q24. What steps do you take to improve a WordPress site’s performance? 
Answer: Implement page caching, use a CDN for assets, optimize and compress images (WebP), minify CSS/JS, and choose high-quality hosting with the latest PHP version.

Q25. Explain the purpose and usage of functions.php in a WordPress theme. 
Answer: It acts as a site-specific plugin. It is used to define theme support (like thumbnails or menus), enqueue scripts and styles, and add custom PHP logic unique to that theme.

Q26. How would you enqueue scripts and styles in a WordPress theme? 
Answer: By using wp_enqueue_script() and wp_enqueue_style() inside a function hooked to the wp_enqueue_scripts action hook to ensure proper dependency management.

Q27. What is a child theme, and why might you use one? 
Answer: It allows for safe modifications to a parent theme. You use it to ensure that your custom styles or functions remain intact even when the original parent theme is updated.

Q28. How do you create a custom page template in WordPress? 
Answer: Create a PHP file in your theme folder and add a header comment: /* Template Name: Name */. You can then select this template from the Page Attributes dropdown in the editor.

Q29. How do you create a custom shortcode in a WordPress plugin? 
Answer: Use the add_shortcode() function, defining a unique tag and a callback function that returns the desired HTML or string output.

Q30. How would you implement AJAX in a WordPress plugin? 
Answer: Enqueue your JS, use wp_localize_script to provide the admin-ajax.php URL, and create PHP handlers using the wp_ajax_ and wp_ajax_nopriv_ hooks.


Security, Performance & Advanced Features

Q31. How would you implement lazy loading for images in WordPress? 
Answer: WordPress does this natively using the loading="lazy" attribute. For older versions or more control, use plugins like WP Rocket or specialized libraries like lazysizes.

Q32. Name some common security vulnerabilities in WordPress and how to mitigate them. 
Answer: SQL Injection (mitigate with $wpdb->prepare), XSS (mitigate by escaping output with esc_html()), and CSRF (mitigate using Nonces to verify request origin).

Q33. How do you properly sanitize and validate user inputs in WordPress? 
Answer: Use sanitize_text_field() or sanitize_email() for cleaning input, and is_email() or absint() for validation before saving data to the database.

Q34. What are Nonce and CSRF protection, and why are they important in WordPress? 
Answer: A Nonce is a “number used once” to verify that a request was sent intentionally by the current user from the current site, protecting against Cross-Site Request Forgery (CSRF).

Q35. Explain what custom post types and taxonomies are and how to create them. 
Answer: Custom Post Types (CPT) are content types like “Products.” Taxonomies are grouping methods like “Brands.” They are created using register_post_type() and register_taxonomy().

Q36. How would you display custom post types on the front end of a WordPress site? 
Answer: By creating specific templates like archive-{post_type}.php and single-{post_type}.php, or by using a custom WP_Query in any template file.

Q37. What is the purpose of the register_post_type() function? 
Answer: It registers a new content type in the WordPress system, defining its labels, visibility, dashboard icon, and which features (like editor or thumbnails) it supports.

Q38. What are some best practices for deploying WordPress sites? 
Answer: Use version control (Git), maintain separate environments (Dev/Staging/Prod), automate the deployment of files, and use a safe database search-and-replace tool for migrations.

Q39. How can you manage configuration settings for different environments (e.g., development, staging, production)? Answer: By using environment variables or conditional checks in wp-config.php to define different database credentials and set WP_DEBUG to true only on development servers.

Q40. How can you make a WordPress site multilingual? What plugins or methods would you use? 
Answer: By using plugins like WPMLPolylang, or TranslatePress. These handle the duplication of posts or the translation of strings and taxonomies for different locales.

Q41. How would you integrate a third-party API into a WordPress site? Describe a scenario where you needed to integrate a payment gateway into a WordPress site. 
Answer: Use the WordPress HTTP API (wp_remote_get()/wp_remote_post()). Scenario: Integrating a Stripe payment gateway by sending checkout data to Stripe’s API and processing the return via a custom webhook.

Q42. What are custom post types in WordPress? How would you create a custom post type and customize its settings?Answer: CPTs allow for content beyond Posts and Pages. You customize them by passing an array of arguments to register_post_type(), such as publicly_queryableshow_in_rest (for Gutenberg), and hierarchical.

Q43. Can you explain the difference between categories and tags in WordPress? How would you use them effectively in organizing content? 
Answer: Categories are hierarchical and intended for broad grouping. Tags are non-hierarchical and used for specific keywords. Use categories for the main “sections” of a site and tags for cross-topic descriptors.

Q44. How does WordPress handle security? What are some common security best practices you follow when developing WordPress websites? 
Answer: WordPress core is regularly audited. Best practices include using the latest PHP, hiding the WP version, securing the wp-config.php file, and using the built-in functions for sanitization and escaping.

Q45. How would you optimize the performance of a WordPress website? Mention some techniques or plugins you would use to improve site speed. 
Answer: Use page caching (WP Rocket), utilize a persistent object cache (Redis), optimize images, use a lightweight theme, and choose a host that supports server-side caching and HTTP/3.

Q46. Can you explain how permalinks work in WordPress? How would you customize the permalink structure and handle URL redirections? 
Answer: Permalinks use rewrite rules to map clean URLs to internal queries. Customize them in Settings > Permalinks. Redirections are best handled via the Redirection plugin or directly in .htaccess/Nginx config.

Q47. How would you troubleshoot and debug common issues in WordPress? What tools or techniques do you use for debugging? 
Answer: Enable WP_DEBUG and WP_DEBUG_LOG, use the Query Monitor plugin to find slow queries or PHP errors, and use browser developer tools to check for JS conflicts.

Q48. Can you explain the concept of shortcodes in WordPress? Provide an example of how you would create and use a shortcode to add dynamic functionality to a post or page. 
Answer: Shortcodes are macros used to add dynamic content. Example: add_shortcode('site_name', function() { return get_bloginfo('name'); });. Using [site_name] in the editor would then display the site’s name.

Q49. How do you plan to ensure the site is user-friendly and accessible? 
Answer: By following WCAG standards: use semantic HTML tags, ensure high color contrast, provide alt text for all images, and ensure the site is fully navigable via keyboard.

Q50. How do you plan to test the site before launch? 
Answer: Run cross-browser testing, check mobile responsiveness on real devices, run speed tests (Google PageSpeed), check for 404 links, and test all contact forms and e-commerce flows.