WordPress Interview Questions and Answers

Wordpress Interview Questions and Answers - iCoreThink Technologies

WordPress Interview Questions and Answers

Q-1 What is WordPress?
Ans.
The WordPress web site defines WordPress as “web software you can use to
create a beautiful website or blog. “ That describes it in the simplest
form possible though I will
try to expand on that. WordPress is the platform that we currently use
for the majority of all client web sites. It was originally used for
blogs but has since expanded to
be used for full web sites, both personal and business. The main reason
people prefer using WordPress now is that it is extremely easy to use,
even for a beginner. Once the
site is setup (that is where we come in) you will be able to update the
content of your web site yourself, without having to know any
programming at all! If you are able to
create a document in Microsoft Word then you will be bale to update your web site, it is that easy.

WordPress also allows your site to be expanded with incredible
features thanks to the many plugins available. We will determine at the
start of the project what you will
need and everything will be setup and customized for you.

Q-2 Tell me Is a web site on WordPress secure?
Ans.
Out of the box WordPress is secure and you should not have to worry
about any problems with your site. While we agree with that sentiment it
does not stop us from taking
extra steps to be positive your site will be secure. Part of the process
of creating your site involves us taking extra measures to be sure your
site will be secure for
you. There are many things we will do that you will never need to
understand, but unlike many design firms we will not just do a basic
install and walk away. This will help
prevent attacks against your web site (something that is not very common to begin with though).

There is a common myth that WordPress web sites are more prone to be
attacked or hacked than a normal web site. After working on nothing but
WordPress sites and blogs for
the past three years I have only had to go in and repair a single site
and that was due to a problem with the host of the site and not the site
itself. Major businesses
now use WordPress for their web sites, I am sure they would not do so if they felt it was not secure.

Q-3 What is the difference between characters 23 and x23?
Ans.
The first one is octal 23, the second is hex 23.

Q-4 How come the code works, but doesnt for two-dimensional array of mine?
Ans.
Any time you have an array with more than one dimension, complex parsing
syntax is required. print “Contents: {$arr[1][2]}” would’ve worked.
/>

Q-5 Tell me Would you initialize your strings with single quotes or double quotes?
Ans.
Since the data inside the single-quoted string is not parsed for
variable substitution, it’s always a better idea speed-wise to
initialize a string with single quotes,
unless you specifically need variable substitution.

Q-6 Do you know Why doesnt the following code print the new line properly?
Ans.

$str = ‘Hello, there.nHow are you?nThanks for visiting Us’;
print $str;
?>
Because inside the single quotes the n character is not interpreted as newline, just as a sequence of two characters – and n.

Q-7 How to call a constructor for a parent class?
Ans.
parent::constructor($value).

Q-8 Tell me Are objects passed by value or by reference?
Ans.
Everything is passed by value.

Q-9 What is the difference between accessing a class method via -> and via ::?
Ans.
:: is allowed to access methods that can perform static operations, i.e. those, which do not require object initialization.

Q-10 Suppose If the variable $a is equal to 5 and variable $b is equal to character a, whats the value of $$b?
Ans.
100, it’s a reference to existing variable.

Q-11 How to find out the number of parameters passed into function?
Ans.
func_num_args() function returns the number of parameters passed in.

Q-12 What is the ternary conditional operator in PHP?
Ans.
Expression preceding the ? is evaluated, if it’s true, then the
expression preceding the : is executed, otherwise, the expression
following : is executed.

Q-13 Explain When are you supposed to use endif to end the conditional statement?
Ans.
When the original if was followed by : and then the code block without braces.

Q-14 Explain Will comparison of string 10″ and integer 11 work in PHP?
Ans.
Yes, internally PHP will cast everything to the integer type, so numbers 10 and 11 will be compared.

Q-15 How to pass a variable by value in WordPress?
Ans.
Just like in C++, put an ampersand in front of it, like $a = &$b

Q-16 Do you know Would I use print $a dollars or {$a} dollars to print out the amount of dollars in this example?
Ans.
In this example it wouldn’t matter, since the variable is all by itself,
but if you were to print something like “{$a},000,000 mln dollars”,
then
you definitely need to use the braces.

Q-17 Suppose I am trying to assign a variable the value of 0123,
but it keeps coming up with a different number, whats the problem?

Ans.
PHP Interpreter treats numbers beginning with 0 as octal. Look at the similar PHP interview questions for more numeric problems.

Q-18 What are the features of WordPress?
Ans.
The key features of wordpress are –
1. Full standards compliance
2. No rebuilding
3. WordPress Pages
4. WordPress Links
5. WordPress Themes
6. Cross-blog communication tools
7. Comments
8. Spam protection
9. Full user registration
10. Password Protected Posts
11. Easy installation and upgrades
12. Easy Importing
13. XML-RPC interface
14. Workflow
15. Typographical niceties
16. Intelligent text formatting
17. Multiple authors
18. Bookmarklets
19. Ping away

Q-19 How many tables a default WordPress will have?
Ans.
A default wordpress will have 11 tables. They are:
1. wp_commentmeta
2. wp_comments
3. wp_links
4. wp_options
5. wp_postmeta
6. wp_posts
7. wp_terms
8. wp_term_relationships
9. wp_term_taxonomy
10.wp_usermeta
11.wp_users

Q-20 Who is the founder of WordPress?
Ans.
Matthew Charles Mullenweg.

Q-21 Are there any limitations to a WordPress web site?
Ans.
Not that we have found yet. You can use WordPress for e-commerce sites,
membership sites, photo galleries and any other type of site you can
think
of. The web site is created using the same html code as any other site
so there are no limitations there either. I have yet to find a reason
not to
use WordPress for any client site.

Q-22 Do I need to have a blog in order to use WordPress for my site?
Ans.
WordPress was originally used as blogging software (and still is) though
it has since become popular for web sites also. You do not need to
include
a blog on your web site in order to use WordPress. We have created a
number of sites that do not have any blog at all but the client wanted
the
ability to update content themselves so we used WordPress. We do suggest
having a blog because it will help with your search engine
optimization.
Though we only suggest that if you plan on updating the blog on a
regular basis, otherwise having a blog without any updates is not going
to do you
any good.

Q-23 Will using WordPress help my site show up on Google?
Ans.
Yes. That is one of the major selling points of using WordPress is that
it includes excellent built in search engine optimization (SEO). With a
normal site you would need to include all of the SEO yourself (or hire
someone). While it is still recommended that you hire someone for a full
SEO
campaign if needed, the built in SEO capabilities of WordPress more than
enough to get you started. We will also install additional plugins to
help
with your SEO when you first launch the site. These are popular plugins
that are known to help your rank on search engines such as Google and
Bing.

Q-24 Do I need to know any programming to make updates?
Ans.
To initially setup a site and customize it you will, though you don’t
need to worry about that because that is what we are doing for you. Once
the
site is setup we will train you on how to perform the updates (very
simple) and you will be good to go. In order to perform the content
updates you
may need in the future you will not need to know any programming at all.
I compared it earlier to using Microsoft Word and it really is that
easy!
Forget about having to hire a programmer to make simple text updates on
your site from now on, you can go in and do it yourself in a matter of
minutes.

Q-25 Will I have the ability to update my own content?
Ans.
That depends on the site/project itself. We have created sites where
almost every aspect could be edited by the client (content, navigation,
photos,
forms, etc) and others where it was a simple setup to allow for the main
content areas to be edited. This is something we will discuss when
planning
the project and determine what your need will be. At the very least you
will be able to edit the site content yourself and the ability to
add/remove
photos.

Q-26 How to hide the top admin bar at the frontend of wordpress 3.4?
Ans.
Add the below mentioned code in the theme(active) function.php add_filter(‘show_admin_bar’, ‘__return_false’);
(or)

Add the below code in the active theme stylesheet
/*
#wpadminbar {
display: none; visibility: hidden;
}
*/

Q-27 How to run Any Query on the Database for WordPress?
Ans.
The query function allows you to execute any SQL query on the WordPress
database. It is best to use a more specific function (see below),
however,
for SELECT queries.

query(‘query’); ?>

Q-28 What are rules to follow in wordpress plugin development?
Ans.
Find a unique name
Setup a prefix (related to your brand)
Create the plugin’s folder
Create sub-folders for PHP files, assets, and translations
Create the main plugin file and fill in obligatory header information
Create a readme.txt file
Use proper constants and functions to detect paths to plugin files
Create additional PHP files and include them inside the main one
Create activation and deactivation functions
Create an uninstall script

Q-29 What is hooks and types of hooks in wordpress?
Ans.
Hooks are provided by WordPress to allow your plugin to ‘hook into’ the
rest of WordPress; that is, to call functions in your plugin at specific
times, and thereby set your plugin in motion. There are two kinds of hooks:

Actions: Actions are the hooks that the WordPress core launches at
specific points during execution, or when specific events occur. Your
plugin can
specify that one or more of its PHP functions are executed at these points, using the Action API.
Filters: Filters are the hooks that WordPress launches to modify text of
various types before adding it to the database or sending it to the
browser
screen. Your plugin can specify that one or more of its PHP functions is
executed to modify specific types of text at these times, using the
Filter
API.

Actions Functions:
has_action()
add_action()
do_action()
do_action_ref_array()
did_action()
remove_action()
remove_all_actions()

Filter Functions:
has_filter()
add_filter()
apply_filters()
apply_filters_ref_array()
current_filter()
merge_filters()
remove_filter()
remove_all_filters()

Q-30 Does the 644 permissions on wp-config.php compromise the username and password to all other users on my shared server?
Ans.
This is a limitation of the way PHP is set up on your server. If you
previously used MovableType, Perl was probably set up with suexec so
Movable
Type executed as your user. In this case, PHP is running as the web
server user, which is why it has to be at least 444. There is phpsuexec
but it
seems many hosts don’t use it.

However this is often not an issue on modern shared hosts because
even though the file is “world” readable each account is set up with a
“jailshell”
which keeps people locked in their home directory, and PHP can be easily
modified with an open_basedir restriction to keep people from writing
PHP
scripts to read your files. If you are really concerned, you should contact your host to see what measures they are taking.

Q-31 How do I prevent my images from being hot-linked by another website?
Ans.
You can use your .htaccess file to protect images from being hot linked,
or, in other words, being linked-to from other websites. This can be a
drain on your bandwidth, because if someone links directly to the image on your site, then you lose the bandwidth.

Q-32 How do I prevent comment flooding?
Ans.
Comment flooding is when a lot of comments (probably spam) are posted to
your website in a very short duration of time. This is only one aspect
of
the broader problem of comment spam in general, but it can quickly
overwhelm a moderator’s ability to manually delete the offending
comments.Comment
flooding is when a lot of comments (probably spam) are posted to your
website in a very short duration of time. This is only one aspect of the
broader problem of comment spam in general, but it can quickly overwhelm
a moderator’s ability to manually delete the offending comments.

WordPress manages the worst floods automatically by default. Any
commenters from the same IP or e-mail address (other than registered
users with
manage_options capabilities) that post within 15 seconds of their last
comment gets their comment discarded. The time setting can be changed by
a
number of plugins that extend this functionality. You might also
consider one of the many broader spam blocking plugins, such as Akismet,
or even
turning your comment system over to Disqus.

You could also just change the time setting by directly hacking the
core file, but the correct way would be to create and install a very
basic
plugin and insert the following code:

function dam_the_flood( $dam_it, $time_last, $time_new ) {
if ( ($time_new – $time_last) < 300 ) // time interval is 300
return true; // seconds
return false;
}
add_filter(‘comment_flood_filter’, ‘dam_the_flood’, 10, 3);

Q-33 How do I redirect users back to my blog’s main page after they login?
Ans.
By default, WordPress reroutes a registered user to the Administration
Panels after they log into the blog. To change the page, there are
WordPress
Plugins that can handle the redirect, or you can set the Theme function to handle it. See Function_Reference/wp_login_url.

Q-34 Why can’t I delete the uncategorized Category?
Ans.
Any Category with a non-zero value for # of Posts in the Administration
> Manage > Categories cannot be deleted. The uncategorized
Category might be
assigned to some Posts, but all Pages are assigned the uncategorized
Category. So even though there may be no posts assigned to the
uncategorized
Category, Pages are included in the count of # of Posts.

The default category cannot be deleted even if it is empty, however
you can specify your default categories for posts or links on the
Options –
Writing page of the admin panel.

Q-35 How can I have a static front page and posts display on a page called Blog?
Ans.
If using WordPress as a CMS, you might want to present readers with a
static front page, and then display your posts on another page called
Blog. To
accomplish that follow these instructions:

Create a Page and use “My Front Page” for the Page Title. Of course,
in the content for that Page, you can enter the information you want
presented
on your site’s front page (see example below if you want to display a post).

Create a Page and call it Blog. Nothing needs to be entered in the content field of this Page.

In Administration > Settings > Reading set the Front page
displays to A static page, and select My Front Page for Front page:, and
select Blog for
the Posts page:.

If you want to further customize your front page, you can create a Template, and fit it to meet your needs:

With the help of the Template Hierarchy article, determine what
Template is normally used to display your Pages (e.g. page.php or
index.php).

Copy that template to myfront.php. If you were using the WordPress Default theme you would copy
wp-content/themes/default/page.php to wp-content/themes/default/myfront.php.

In Administration > Appearance > Editor, edit the myfront.php and change the beginning of the file from:

/**
* @package WordPress
* @subpackage Default_Theme
*/
?>

to:

/*
Template Name: MyFront
*/
?>

Then access the Page called Front in Administration > Page > Edit and set the Template to MyFront.
Once that’s all working, begin changing myfront.php to make it look like what you want.
That’s it. You are done.

Use this example for the ‘MyFront’ Page Template if you want to
display one post, instead of the Page content, on your ‘static front
page’:

/*
Template Name: MyFront
*/
?>

query_posts(‘p=1′); //set p=x where x is post id of post you want to see or use query_posts(‘cat=1&posts_per_page=1);
//to show one post from Category 1
if (have_posts()) :
?>

id=”post-”>

” rel=”bookmark” title=”Permanent Link to ”>

–>

’); ?> Posted in |

Not Found

Sorry, but you are looking for something that isn’t here.

Q-36 Tell some commonly used functions in wordpress.
Ans.
Wordpress have lot of inbuilt functions. Some of commonly used function in wordpress are:

wp_nav_menu() :- Displays a navigation menu.
is_page() :- Condition for check if page is displayed. Its return true or false only.
get_the_excerpt() :- Copy the excerpt of the post into a specified variable.
in_category() :- Tests if the specified post is assigned to any of the specified categories or not.
the_title():- Displays the title of the post.
the_content():- Displays the contents of the post.

Q-37 What is file structure in wordpress.
Ans.
The main files used in wordpress are:

index.php :- for index page.
single.php :- for single post page.
page.php :- display the static pages.
category.php :- Display the category page.
archive.php :- For archive page display.
tag.php :- For display the tags page.
author.php :- For display author page.
search.php :- For display the search result page.
404.php :- For display 404 error page.
taxonomy.php :- For display the taxonomy archive.
attachment.php :- For managing the single attachments page.
header.php :- For managing top part of page.
footer.php :- For manage bottom part of pages.

Q-38 What are the template tags in wordpress?
Ans.
A template tag is code that instructs WordPress to “do” or “get”
something. Like in header.php we will use the tag bloginfo(‘name’) to
get
information from user profile.

The the_title() template tag is used to display the post title.
wp_list_cats() are for display categories.
get_header() for getting header.
get_sidebar() for display the sidebar on page.
get_footer() for get the footer content on page.

Q-39 What are meta tags?
Ans.
Meta tags keywords and description are used to display information about website or page.The commonly used meta tags are:-

Source:- icorethink.com