IT Training Indore Provide Latest Question & Answer Which Are Generally Ask in WordPress Interview
What is WordPress?
WordPress is an open source Content Management System which can be used to build websites and Blogs. WordPress was released in 2003 and it is based on PHP & MYSQL.
What is the current version of WordPress?
The current version of WordPress is 6.2.
How can you backup or import your WordPress content from the admin panel?
For import content from WordPress admin panel goes to:-
WordPress admin -> Tools -> Import
This will create a xml file for your posts, comments, category etc.
What are hooks in WordPress?
Wordpress hooks allows users to create or modify WordPress themes / plugins with shortcodes without changing the original files. There are two types of hooks:
- Action Hooks
- Filter Hooks
Action Hooks: – Action hooks are points in WordPress core where it’s possible for outside resources to insert additional code.
For example- wp_head() , the_post(), get_sidebar() is an action hook which is used by most of the themes. To hook an action, create a hook in your function file and hook it using add_action() function.
<?php
add_action( ‘wp_head’, ‘head_func’ );
function head_func () {
echo “<div>This is test</div>”;
}
?>
Filter Hooks: – Filter hooks are used to handle output like using it you will add an text or content at end of content of your post. You will add a filter using the add_filter() function. There are various filters used in wordpress such as the_title(), wp_title(), get_the_excerpt(), get_to_ping(), attachment_icon().
For example:- Using these filters we will add content and end of posts.
<?php add_filter( ‘the_content’, ‘webs_expert’ );
function head_func( $content ) {
if ( is_single() ) {
$content .= ‘<div>This is test</div>’ . ” “;
}
return $content;
}
What are the custom fields in WordPress?
We will add extra information to your post by using custom fields. Custom Fields are a form of meta-data that allows you to store arbitrary information with each WordPress post.
Meta-data is handled with key/value pairs. The key is the name of the meta-data element. The value is the information that will appear in the meta-data list on each individual post that the information is associated with.
To display the Custom Fields for each post, use the the_meta() template tag.
To fetch meta values use the get_post_meta() function.
For example we use custom fields:-
<?php echo get_post_meta($post->ID, ‘key’, true); ?>
Can WordPress use cookies?
Yes, WordPress uses cookies. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users.
How many tables a default WordPress will have?
A default WordPress will have 11 tables. They are-
- wp_commentmeta
- wp_comments
- wp_links
- wp_options
- wp_postmeta
- wp_posts
- wp_terms
- wp_term_relationships
- wp_term_taxonomy
- wp_usermeta
- wp_users
What is the WordPress loop?
The Loop is PHP code used by WordPress to display posts. Using The Loop, WordPress processes each post to be displayed on the current page.
For example:-
<?php
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
//
// Post Content here
//
} // end while
} // end if
?>