WordPress Interview Question Final
WordPress Interview Question Final
Section A:
1. What is WordPress loop?
3. What are the types of hooks in WordPress and mention their functions?
4. What do you mean by custom field, Custom Post, Custom Page Template in
WordPress?
1
5. What are the steps you can take if your WordPress file is hacked?
6. Is WordPress safe from brute force login attempts? If not, how can you prevent such
an attack vector?
2
Section B:
1. Consider the following code snippet. Briefly explain what changes it will achieve,
who can and cannot view its effects.
add_action('admin_menu', 'custom_menu');
function custom_menu(){
add_menu_page('Custom Menu', 'Custom Menu', 'manage_options', 'custom-menu-slug',
'custom_menu_page_display');
}
function custom_menu_page_display(){
echo '<h1>Hello World</h1>';
echo '<p>This is a custom page</p>';
}
Ans:
2. What is the $wpdb variable in WordPress, and how can you use it to improve the
following code?
<?php
function perform_database_action(){
mysql_query(“INSERT into table_name (col1, col2, col3) VALUES ('$value1','$value2',
'$value3');
}
Ans:
3
3. Consider the following code snippet and explain the purpose of wp_enqueue_script.
Can you figure out if something is wrong in the snippet?
add_custom_script();
function add_custom_script(){
wp_enqueue_script(
'jquery-custom-script',
plugin_dir_url( __FILE__ ).'js/jquery-custom-script.js'
);
}
Ans:
4. The following line is in a function inside a theme’s “function.php” file. What is wrong
with this line of code?
wp_enqueue_script('custom-script', '/js/functions.js');
Ans:
4
<div class="notice notice-success is-dismissible">
<p><?php _e( 'Done!', 'sample-text-domain' ); ?></p>
</div>
<?php }
add_action( 'admin_notices', 'sample_admin_notice__success' );
Ans:
6. What is the file name, which located in the root of your WordPress installation directory
and contains your website’s setup details, such as database connection info?
Ans:
7. How can you enable the Network Setup menu item(enable Multisite) in WordPress?
Ans: