Wordpress test 2016

Unknown 6:03:00 AM
25. Which of the following code snippets best protects a system from SQL injections?
Answers:
• sql_real_escape_strong()
• mysql_real_escape()
• mysql_real_escape_string()
• mysql_not_real_delete_string()
77. Which of the following is a quick way to move a Wordpress website from one server to another?
Answers:
• Using migration plugin
• Copying wordpress files and database from source to destination server
• Using XML export through wp-admin interface
• Install new wordpress and copy theme and plugin directory
69. Which of the following functions are used when adding CSS and jQuery codes on a WordPress plugin?
Answers:
• wp_register_style
• wp_enqueue_style
• wp_enqueue_script
• None of these.
18. Which of the following actions must be performed to import data from wordpress.com?
Answers:
• Enter the full access to wordpress.com into the data import form so that it can automatically connect and directly retrieve content.
• Import from wordpress.com's RSS.
• Login to wordpress.com, then the export data using the export tool, then import an exported xml file to the site.
16. Which of the following is the correct sequence of steps to adapt a WordPress plugin to a multisite?
Answers:
• 1. Use $wpdb to iterate through all blogs 2. Hook according to the $blog_id 3. Install the plugin as Network only 4. Uninstall depends the specific plugin
• 1. Use $wp_posts to iterate through all blogs 2. Hook according to the $function 3. IInstall the plugin as Network only 4. Uninstall depends the specific plugin
• 1. Use $wp_posts to iterate through all blogs 2. Hook according to the $function 3. Install other activations except Network 4. Uninstall is the same for all the plugins
• 1. Use $wp_posts to iterate through all blogs 2. Hook according to the $function 3. Install the plugin as Network only 4. Uninstall is same for all the plugins
67. Which of the following is the correct code to get an array of every image uploaded to a particular post?
Answers:
• $images =& get_children( 'post_type=attachment&post_mime_type=image&post_parent=10' );
• $images = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
• $images = get_post(7, ARRAY_A);
• It cannot be done
2. 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).
Answers:
• my_admin()
• view_admin()
• is_admin()
• root_admin()
29. Which of the following will correctly load localized (translated) text for a WordPress plugin?
Answers:
• function custom_theme_setup() { $lang_dir = get_template_directory() . '/lang'); load_theme_textdomain('tutsplus', $lang_dir); } add_action('after_setup_theme', 'custom_theme_setup');
• function custom_theme_setup() { $lang_dir = get_template_directory() . '/lang'); add_action('after_setup_theme', 'custom_theme_setup'); }
• function custom_theme_setup() { $lang_dir = get_template_directory() . '/lang'); add_action('after_setup_theme', 'custom_theme_setup'); } load_theme_textdomain('tutsplus', $lang_dir);
• function load_theme_textdomain('tutsplus', $lang_dir); { $lang_dir = get_template_directory() . '/lang'); custom_theme_setup(); } add_action('after_setup_theme', 'custom_theme_setup');
24. Can the contents of the wp-content folder be moved or renamed without changing any settings?
Answers:
• Yes
• No
71. How can the class name of a sub-menu be changed in the wp_nav_menu?
Answers:
• By manually adding the class name in Appearance-->Menus
• Wordpress does not support the ability to change the class name of a sub-menu in the wp_nav_menu.
• By adding the following code in functions.php: class UL_Class_Walker extends Walker_Nav_Menu { function start_lvl(&$output, $depth) { $indent = str_repeat("\t", $depth); $output .= "\n$indent<ul class=\"level-".$depth."\">\n"; } }
• By adding the following code in header.php: class UL_Class_Walker extends Walker_Nav_Menu { function start_lvl(&$output, $depth) { $indent = str_repeat("\t", $depth); $output .= "\n$indent<ul class=\"level-".$depth."\">\n"; } }
65. Which of the following is the correct way to get WordPress Post ID from the Post title?
Answers:
• $page = get_page_title( 'About' ); wp_pages( 'exclude=' . $page->ID );
• $page = get_page_by_title( 'Home' ); $page_id = $page->ID;
• $page = get_page_by_title( 'About' ); wp_pages( 'exclude=' . $page->ID );
• None of the above
62. Which of the following code snippets will create plugins back-end page without showing it as menu item?
Answers:
• add_submenu_page with parent slug = null
• add_menu_page with parent slug = null
• add_submenu_page without parent slug = null
• add_menu_page without parent slug = null
1. Which of the following will hash a string/password to its md5 equivalent?
Answers:
• md5()
• wp_generate_password()
• wp_generate_md5()
• password_md5()
52. Which of the following commands can change the ownership of WordPress directory to www-data (for Apache)?
Answers:
• sudo chown -Rf www-data *
• chown -Rf www-data *
• sudo crown -Df www-data *
• Alldo chown -Rf www-data *
34. 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];
Answers:
• $firstTag[‘slug’];
• $firstTag->slug
• $firstTag.slug
• $firstTag[0][‘slug’]
55. 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?
Answers:
• add_action('init','possibly_redirect'); function possibly_redirect(){ global $pagenow; if( 'wp-login.php' == $pagenow ) { return('Your custom url'); exit(); } }
• add_action('init','possibly_redirect'); function possibly_redirect(){ global $pagenow; if( 'wp-login.php' == $pagenow ) { wp_redirect('Your custom url'); exit(); } }
• add_action('init','possibly_redirect'); function possibly_redirect(){ global $pagenow; if( 'wp-login.php' == $pagenow ) { redirect('Your custom url'); exit(); } }
• add_action('init','possibly_redirect'); function possibly_redirect(){ global $pagenow; if( 'wp-login.php' == $pagenow ) { wp_return('Your custom url'); exit(); } }
57. What is the first action you need to take for enabling the WordPress multisite (MS) feature?
Answers:
• Enable the WordPress multisite feature on admin panel
• Enable the Network feature
• Add this code to wp-config.php file: define( 'WP_ALLOW_MULTISITE', true );
64. Are categories and tags available for pages?
 
<b>Note:</b> Categories must have distinct slugs. Even if two categories have different parents and would therefore have different permalinks, you can't assign them the same slug.
Answers:
• Yes
• No
63. ____________ can manage their own profiles, but can do virtually nothing else in the administration area.
Answers:
• Contributor
• Author
• Editor
• Subscriber
• Administrator
19. Meta tags can be added to WordPress pages by ________________.
Answers:
• using plug-ins
• adding them to the header.php file
• updating the database
• a and
• and c
54. How can a post ID be retrieved from the permalink?
Answers:
• Its not possible to retrieve the post ID from a permalink due to its structure.
• It can be retrieved by using a Regular Expression.
• wp_get_post_id($permalink)
• url_to_postid($permalink)
28. Which of the following is the correct way to retrieve a featured image from a post?
Answers:
• <?php echo get_post_thumb($page->ID, 'thumbnail'); ?>
• <?php echo get_featured_image($page->ID, 'thumbnail'); ?>
• <?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?>
• <?php echo get_post_thumbnail($page->ID, 'thumbnail'); ?>
13. Which of the following methods can be used to make permalinks SEO friendly?
Answers:
• Updating the database.
• Changing the source code.
• Configuring the feature in the config file.
• Configuring the feature in the admin settings.
66. Which of the following will correctly add custom mod rewrite rules to .htaccess from a WordPress plugin?
Answers:
• $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 = & $POST["wp_rewrite"]; }}
• $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"]; } }
• $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); } }
• $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 = & $SESSION["wp_rewrite"]; } }
5. What is the BEST way to get last inserted row ID from Wordpress database ?
Answers:
• Use the following code snippet $lastid->$wpdb=$last->get_row;
• The call to mysql_insert_id() inside a transaction should be added: mysql_query('BEGIN'); // Whatever code that does the insert here. $id = mysql_insert_id(); mysql_query('COMMIT'); // Stuff with $id.
• The following code snippet should be added $last = $wpdb->get_row("SHOW TABLE STATUS LIKE 'table_name'"); $lastid = $last->Auto_increment;
• Straight after the $wpdb->insert() insert, the following code should be added: $lastid = $wpdb->insert_id;
67. Which of the following is the correct code to get an array of every image uploaded to a particular post?
Answers:
• $images =& get_children( 'post_type=attachment&post_mime_type=image&post_parent=10' );
• $images = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
• $images = get_post(7, ARRAY_A);
• It cannot be done
10. Which of the following is an example of a WordPress plugin that provides multilingual capabilities?
Answers:
• WP Super Cache
• qTranslate
• BuddyPress
• Hotfix
53. How can a custom content filter be added?
Answers:
• By using add_action('the_content','my_custom_filter')
• By using add_filter('the_content','my_custom_filter')
• By using wp_filter('the_content','my_custom_filter')
• By using add_action('content','my_custom_filter')
11. Which of the following functions can be used to create a WordPress page?
Answers:
• wp_insert_post()
• wp_insert_page()
• wp_create_post()
• wp_create_page()
39. What is the first action you need to take for enabling WordPress MU feature?
Answers:
• Enable WordPress MU feature on admin panel
• Enable Network feature
• Add this code to wp-config.php file: define( 'WP_ALLOW_MULTISITE', true );
8. How can the upload media panel be included in a Wordpress template/plugin?
Answers:
• By using function wp_enqueue_script('media-upload')
• By using function wp_add_media( );
• By using function wp_enqueue_script('upload');
• By using function wp_add_script('media-upload');
31. How can a user be found through its meta data?
Answers:
• User can not be retrieved through its meta data
• get_user_by_metadata($metaid,$metavalue)
• get_user($args)
• get_users($args)
41. You can limit the number of revisions WordPress stores by _____
 
<b>Note:</b> Categories must have distinct slugs. Even if two categories have different parents and would therefore have different permalinks, you can't assign them the same slug.
Answers:
• adding the following line to your wp-config.php file: define('WP_POST_REVISIONS', 3);
• using a plugin
• changing a setting on admin panel
75. Who of the following persons can read a post locked by password?
Answers:
• Only administrators, editors and authors
• Registered users who knows password
• Anyone who knows a password
37. A possible way to allow the display of several authors' names on one post is to ______
Answers:
• update the database
• change the admin settings
• change the config files
• use a plug-in
4. Which of the following WordPress Multisite functions allows for getting content from one blog and display it on another?
Answers:
• switch_blog()
• switch_to_blog()
• restore_current_blog()
• restore_to_current_blog()
7. Which of the following code snippets can be used to create custom POST status in wordpress 3.0 +?
Answers:
• register_new_post()
• register_post_status()
• add_new_post_status()
• modify_post_status()
58. Which of the functions below is required to create a new taxonomy?
Answers:
• add_taxonomy
• register_taxonomy
• create_taxonomy
43. One possible way to collect realtime statistics about traffic on a WordPress site is:
Answers:
• using a built-in tool
• using a plugin
• using a widget
• Traffic statistics cannot be collected on a WordPress site.







Share this

Related Posts

Latest
Previous
Next Post »