WordPress Interview Questions and Answers
WordPress is web software you can use to create a beautiful website or blog. We like to say that WordPress is both free and priceless at the same time.
WordPress is an Open Source project, which means there are hundreds of people all over the world working on it. (More than most commercial platforms.) It also means you are free to use it for anything from your recipe site to a Fortune 500 web site without paying anyone a license fee and a number of other important freedoms.
WordPress is a free CMS (Content Management System) came in 2003.
There are 12 default database tables in WordPress database as given below:
Note: “wp_” is the default prefix but you can change it with another name.
WordPress content is stored in the MySQL database on the Server.
See the list of WordPress Database Tables.
Here are the most popular SEO plugins for WordPress.
- Yoast SEO
- All in One SEO Packs
- The SEO Framework
There are many built-in WordPress functions that we use in theme customization. Here are some of the mostly used WordPress theme functions:
- get_template_directory_uri() – Retrieve template directory URI for the current theme. In the event that a child theme is being used, the parent theme directory URI will be returned. Use get_stylesheet_directory_uri() to include resources that are intended to be included in/overridden by the child theme.
- wp_head() – The wp_head action hook is triggered within the & section. You use this hook by having your function echo output to the browser in HTML head. Most of default actions into the ‘wp-head’ hook by WordPress core. You might use it to include your own js/css and other meta into the WordPress.
- wp_nav_menu() – Displays a navigation menu created in the Appearance → Menus panel. For example: ‘Project Nav’ )); ?>
- home_url()- The home_url template tag retrieves the home URL for the current site
- e_()- Displays the returned translated text from translate()
- get_sidebar() - Includes the sidebar.php template file from your current theme’s directory.
- get_header()- Includes the header.php template file from your current theme’s directory.
- wp_link_pages()- Displays page-links for paginated posts (Next page & Previous Page)
- edit_post_link()- display link to edit current post from dashboard
Here is the list of important WordPress files & directory structure:
- other core PHP files…
- other core PHP files…
- other core PHP files
Sometimes, we only want to show initial WordPress post content on the site. There are many ways to limit the WordPress post content length. One way is to replace WordPress the_content() in WordPress template files with following code.
$article_data = substr(get_the_content(), 0, 300);
Explanation:get_the_content() function contains wordpress content page/post content. Then it will pass it to php substr() function to limit the content to 300 characters. Then you can display wherever you want.
// Example to get home url
$url = home_url();
// Output: https://example.com
// Example to get url of any page using slug
$url = home_url().'/about';
// Output: https://example.com/about