Header Ads

Wordpress Interview Questions and Answers

Wordpress Interview Questions and Answers_w3technology.info

1. What is WordPress?
WordPress is free open source content management system (CMS) written PHP language. It allows users to create dynamic websites from personal blogs to e-commerce. Wordpress current stable version 4.9.7 as on July2018.

2. What year was WordPress released?

3. Minimum requirements to run WordPress?
PHP version 7.2 or greater. MySQL version 5.6 or greater OR MariaDB version 10.0 or greater.

4. Where is WordPress content stored?
MySQL database on Server.

5. Differences between Posts and Pages?
Posts and Pages are the two content types in WP:
1.Posts are timed and listed in chronological order with the latest posts at the top. Posts are meant to be shared and commented on.
2. Pages are static are static content, so an about us, contact us page etc. They are permanent and timeless entries.

6. Types of hooks in WP?
Two types hooks are available in WordPress, action hooks and filter hooks, modify areas in a theme or plugin without modifying the original file.

7. action hook?
An Action hook in WordPress is a hook that is triggered at a specific time when WordPress is running and lets you take an action. This can include things like creating a widget when WordPress is initializing or sending a Tweet when someone publishes a post.
list of some Action hooks functions.

8. filter hook.?

A Filter hook in WordPress allows you get and modify WordPress data before it is sent to the database or the browser. Some examples of filters would include customizing how excerpts are displayed or adding some custom code to the end of a blog post or headings.

example of add_filter
    add_filter('the_content', 'hello_world');
    function hello_world($content){
        return $content . "<h1> Hello World </h1>";
list of some Filter hooks functions.

9. WordPress taxonomy?
In WordPress, a "taxonomy" is a grouping mechanism for some posts (or links or custom post types).There are four default taxonomies in WordPress they are:
Link Category
Post Formats
You are also free to create your custom taxonomies too.

10. Default tables are the WordPress?
WordPress Tables 12.They are:
wp_commentmeta, wp_comments, wp_links, wp_options, wp_postmeta, wp_posts, wp_terms, wp_termmeta, wp_term_relationships,
wp_term_taxonomy, wp_usermeta, wp_users.

11. How to run database Query on WordPress?
<?php $wpdb->query('query'); ?>
other wpdb functions above such as get_results, get_var, get_row or get_col.

12. Does WordPress use cookies?

Yes, WordPress has cookies and uses them for verification purpose of the users while they log in.

13. Write the short code in WordPress php file?

14. In which cases you don’t see plugin menu?
You can’t see your plugin menu when the blog is hosted on free wordpress.com as you cannot add plugin there. Also, if you do not have an account of an administrator level on your WordPress dashboard, it is not possible to see plugin.

15. Difference between the wp_title and the_title tags?
wp_title() function is for use outside "The Loop" to display the title of a Page.the_title() on the other hand is used within "The Loop".

16. How to Create Custom Post Type?
// Our custom post type function
    function create_posttype() {    
        register_post_type( 'movies',
        // CPT Options
                'labels' => array(
                    'name' => __( 'Movies' ),
                    'singular_name' => __( 'Movie' )
                'public' => true,
                'has_archive' => true,
                'rewrite' => array('slug' => 'movies'),
// Hooking up our function to theme setup
add_action( 'init', 'create_posttype' );

17. Check if a page exists by url?
You can use get_page_by_path() function.

18. create mailchimp or vertical response campaign for newsletter subscribers & link with WordPress ?
First Create List & Campaign on mailchimp/ WordPress account . Then subscribe users from WordPress in mailchimp list by plugin or manual hard code webform.

19. How will you retrieve adjacent posts (next/previous) within the same category?
We can retrieve previous post using get_adjacent_post() function and providing it ‘true‘ and taxonomy name in first and last parameters respectively. Setting third parameter to false will bring next adjacent post in front of you.

20. Activate Plugins via Code?

function plugin_activation( $plugin ) {
        if( ! function_exists('activate_plugin') ) {
            require_once ABSPATH . 'wp-admin/includes/plugin.php';
        if( ! is_plugin_active( $plugin ) ) {
            activate_plugin( $plugin );

21. How to Link External jQuery/Javascript files with WordPress
Add your own scripts via wp_enqueue_script() in your template’s functions.php, appropriately setting dependences on jQuery, and wp_head() will add the scripts for you.

22. How to retrieve an image attachment’s alt text?
The wp_get_attachment_image() function which will return an HTML string containing these attributes:

No comments:

Powered by Blogger.