Upwork WordPress Exam Question Answer 2016

Q 1. _____________ can publish, edit, and delete their own posts. They cannot write pages. They can upload some kinds of media files, and they are allowed to use only the limited set of HTML tags.

Answer: Author

Q 2. A possible way to collect real-time statistics about traffic to a WordPress site is to:

Answer: use a plug-in

Q 3. User Level 7 converts to ___________

Answer: Editor

Q 4. User Level 3 converts to ___________

Answer: Author

Q 5. User Level 1 converts to ___________

Answer: Contributor

Q 6. user Level 0 converts to __________

Answer: Subscriber

Q 7. On which of the following databases can WordPress be installed by default?

Answer: MySQL

Q 8. Which of the following methods can be used to make permalinks SEO friendly?

Answer: Configuring the feature in the admin settings.

Q 9. Which of the following codes will return the current plugin directory in WordPress?

Answer : plugin_basename($file);

Q 10. How can a custom content filter be added?

Answer : By using add_filter(‘the_content’,’my_custom filter’)

Q 11. Which of the following actions cannot be hooked in with the add_submenu_page() function?

Answer: admin_menu

Q 12. How many built-in user roles does WordPress have?

Answer: 5

Q 13. Meta tags can be added to WordPress pages by

Answer: using plugins

Q 14. Which of the following WordPress Multisite functions allows for getting content from one blog and display it on another?

Answer : switch_to_blog()

Q 15. You can limit the number of revisions WordPress stores by:

Answer: adding the following line to your wp-config.php file:

define(‘WP_POST_REVISIONS’, 3);

Q 16. What is the name of the theme file for a page with id ‘3’?

Answer: page-3.php

Q 17. __________________ can manage their own profiles, but can do virtually nothing else in the administration area.

Answer: Subscriber

Q 18. Which of the following is the correct way to print the slug property of $firstTag object in this code snippet?

$tags = wp_get_post_tags($post->ID);

$firstTag = $tags[0];

Answer : $firstTag->slug;

Q 19. What is the BEST way to get the last inserted row ID from the WordPress database?

Answer : right after the $wpdb->insert() insert, the following code should be added:

$lastid = $wpdb->insert_id;

Q 20. Which of the following is an Online Code Coloring Service?

Answer: Prettify

Q 21. How would you integrate WordPress Tiny MCE editor with a plugin?

Answer : wp_editor( $content, $id );

Q 22. Which of the following code snippets best protects a system from SQL injections?

Answer : mysql_real_escape_string()

Q 23. Which of the following functions are used to add an administration menu item in WordPress?

Answer : add_menu_page();

Q 24. How can the class name of a sub-menu be changed in the wp_nav_menu?

Answer: By adding the following code in functions.php:

class UL_Class_Walker extends Walker_Nav_Menu{

function start_lv1(&$output, $depth) {

$indent = str_repeat(“\t”, $depth);

$output .= “\n$indent<ul class=\”level-“.$depth.”\”>\n”;



Q 25. What is the first action you need to take for enabling the WordPress multisite (MS)feature?

Answer : add this code to wp-config.php file: define( ‘WP_ALLOW_MULTISITE’, true );

Q 26. Which of the following code snippets will create plugins back-end page without showing it as a menu item?

Answer : add_submenu_page with parent slug = null

Q 27. Which of the following is the correct way to retrieve a featured image from a post?

Answer : echo get_the_post_thumbnail($page->ID, ‘thumbnail’);

Q 28. Which of the following is the correct way to redirect the default login and registration page URL to a custom login and registration page URL?

Answer : add_action(‘init’,’possibly_redirect’);

function possibly_redirect(){

global $pagenow;

if( ‘wp-login.php’ == $pagenow ){

wp_redirect(‘Your custom url’);




Q 29. Which of the following commands can change the ownership of WordPress directory to www-data (for Apache)?

Answer: Sudo Chown -Rf www-data *

Q 30. Can the content of the wp-content folder be moved or renamed without changing any settings?

Answer: No

Q 31. A possible way to allow the display of several authors’ names on one post is to

Answer: use a plug-in

Q 32. Which of the following is an example of a WordPress plugin that provides multilingual capabilities?

Answer: qTranslate

Q 33. Which of the following functions are used when adding CSS and jQuery codes on a WordPress plugin?

Answer : wp_register_style



Q 34. Which of the following will hash a string/password to its md5 equivalent?

Answer : wp_generate_password()

Q 35. Which of the following is a quick way to move a WordPress website from one server to another?

Answer: Using the migration plugin

Q 36. Are categories and tags available for pages?

Answer: No

Q 37. Which of the following is the correct sequence of steps to adapt a WordPress plugin to a multisite?

Answer: 1. Use $wpdb to iterate through all blogs

Hook according to the $blog_id

Install the plugin as Network only

Uninstall depends on the specific plugin

Q 38. Which of the following functions can be used to create a WordPress page?

Answer : wp_insert_post()

Q 39. Which of the following is the correct code to get an array of every image uploaded to a particular post?

Answer : $images =& get_children(‘post_type=attachment&post_mime_type=image&post_parent=10’ );

Q 40. Which of the following is the correct way to get WordPress Post ID from the Post title?

Answer : $page = get_page_by_title( ‘Home‘ );

$page_id = $page ->ID;

Q 41. Which conditional tag checks if the dashboard or the administration panel is attempting to be displayed by returning “true” (if the URL being accessed is in the admin section)or “false” (for a front-end page).

Answer: is_admin()

Q 42. Which of the following will correctly add custom mod rewrite rules to .htaccess from a WordPress plugin?

Answer : $custom_mod_rewrite = new custom_mod_rewrite;

register_activation_hook(__FILE__ , array($custom_mod_rewrite,’flush_rewrite_rules’));

register_deactivation_hook(__FILE__ , array($custom_mod_rewrite,’flush_rewrite_rules’));

add_action(‘generate_rewrite_rules’, array($custom_mod_rewrite,”generate_rewrite_rules”));

class custom_mod_rewrite {

function __construct(){

$this->wp_rewrite = & $GLOBALS[“wp_rewrite”];}

function mod_rewrite_rules($rules){

return preg_replace(‘#^(RewriteRule \^.*/)\?\$plugin_name .*(http://.*)

\[QSA,L\]#mi’, ‘$1 $2 [R=301,L]’, $rules);


Q 43. How can a post ID be retrieved from the permalink?

Answer : url_to_postid($permalink)

Q 44. Which of the following will correctly load localized (translated) text for a WordPress plugin?

Answer : function custom_theme_setup() {

$lang_dir = get_template_directory() . ‘/lang’);

load_theme_textdomain(‘tutsplus’, $lang_dir);


add_action(‘after_setup_theme’, ‘custom_theme_setup’);

I secure 1st place in #Upwork #WordPress Test

How is Your Website Working In Search Engine? Have You Checked Ever? Must Check For Free Below