WordPress Interview Questions & Answers – Part8

71. Why can’t I delete the uncategorized Category?
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.

72. How to Change Your Default WordPress Post Category & Post Type?
Ans. Most common issue and most of developer not know this and find hacking(custom coding solution).But it more easy then that.simply navigate to Settings > Writing > and then look for the pull down menu beside “Default Post Categoy.” for change default category selection.
Below that you can find Default post format for changes post type from standard to image post type or a video post type,chat gallery,link and many more.

73. How can I have a static front page and posts display on a page called Blog?
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


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
<?php get_header(); ?>
<div id=”content”>
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()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div <?php post_class() ?> id=”post-<?php the_ID(); ?>”>
<h2><a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title_attribute(); ?>”><?php the_title(); ?></a></h2>
<small><?php the_time(‘F jS, Y’) ?> <!– by <?php the_author() ?> –></small>
<div class=”entry”>
<?php the_content(‘Read the rest of this entry »’); ?>
<p class=”postmetadata”><?php the_tags(‘Tags: ‘, ‘, ‘, ‘<br />’); ?> Posted in <?php the_category(‘, ‘) ?> | <?php edit_post_link(‘Edit’, ”, ‘ | ‘); ?> <?php comments_popup_link(‘No Comments »’, ’1 Comment »’, ‘% Comments »’); ?></p>
<?php endwhile; ?>
<div class=”navigation”>
<div class=”alignleft”><?php next_posts_link(‘« Older Entries’) ?></div>
<div class=”alignright”><?php previous_posts_link(‘Newer Entries »’) ?></div>
<?php else : ?>
<h2 class=”center”>Not Found</h2>
<p class=”center”>Sorry, but you are looking for something that isn’t here.</p>
<?php get_search_form(); ?>
<?php endif; ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

74.  How to Change the Length of the Default WordPress Excerpt.
The default WordPress excerpt is 55 words long. By modified bit to your functions.php file you can change the length to as you required.Below is the code if we need 60 length.

function new_excerpt_length($length) {
    return 42;

add_filter('excerpt_length', 'new_excerpt_length');

75. Does the 644 permissions on wp-config.php compromise the username and password to all other users on my shared server?
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.

76. How do I prevent comment flooding?
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);

77. How do I determine a Post, Page, Category, Tag, Link, Link Category, or User ID?
Sometimes it is necessary to know the ID of a particular Post, Page, Category, Tag, Link, Link Category, or User. To determine that ID, use one of these method:
Look in your browser status bar for the ID:
Visit the related ‘Edit’ screen in your Administration Panel. For instance in the case of Posts visit Posts->Edit, for Pages visit Pages->Edit, and for Categories visit Posts->Categories.
Now hover your mouse over the ‘item’ you need the ID. In the case of Pages, hover over that particular Page’s title in the Title column and for Categories hover over the Categories Name in the Name column.
Look at the status bar (at the bottom of your browser) and the you will find at the end of the line something like “post=123″ or “cat_ID=67″. In these cases, 123 is the Page ID, and 67 is the Category ID.
Install a plugin:
Install and activate Reveal IDs for WP Admin, Simply Show IDs, or ShowID for Post/Page/Category/Tag/Comment.
Find the ID displayed with each item.

78.  How to add option for open menu item in new tab? 
This is very basic feature but sometime developer never use this so they have no idea and goto code and add manually that links.For add option in menu item for open link in new tab just navigate to “Screen Option” at top right corner in menu select check “link target”. See below screenshot.

79. How can I change what appears between Categories when I post in more than one Category?
To configure the way the post’s categories display, open the index.php file and find the line <div class meta>. There you will see the following code:
<?php the_category() ?>
Inside of the parentheses ( ) and quote marks, add or change this to reflect the new look you desire.
If you would like to have commas between the categories, the tag should read:
<?php the_category(‘,’) ?>
If you would like to have an arrow, the tag would look like this:
<?php the_category(‘ > ‘) ?>
If you would like to have a bullet, the tag would look like this:
<?php the_category(‘ &bull; ‘) ?>
If you would like the “pipe” ( | ) between the categories, the tag would look like this:
<?php the_category(‘ | ‘) ?>
Use your imagination and creativity to make the separations in the categories look any way you like.

80. Why are all the comments being moderated?
Go to the Options > Discussion panel and make sure that An administrator must approve the comment (regardless of any matches below) is unchecked. With that option selected, all comments are sent to the moderation queue to await approval. Make sure that Hold a comment in the queue if it contains more than x links is not blank and contains a number higher than zero. If this value is blank or zero, all comments containing links will be moderated. If the option mentioned above is unchecked, the link moderation value is higher than zero, and you still have this problem, your Spam Words list probably has blank lines, punctuation marks, or single letters between the information in the list. There should be spaces between the listed items or each item must be on its own line. If you have done this, then upgrade the comment spam plugins you have installed. If this continues to be a problem, deactivate the comment spam plugins one by one to determine the culprit and contact the plugin author for help.

Sign-up for our email newsletter and get free job alerts, current affairs and GK updates regularly.
Subscribe Here (or)

One Response to “WordPress Interview Questions & Answers – Part8”

  1. bonnaroo says:

    Very good info. Lucky me I found your website to enhance my wordpress skills

Leave a Reply

Your email address will not be published. Required fields are marked *

1 × one =

Popup Dialog Box Powered By : XYZScripts.com
  • RSS
  • Facebook
  • Google+
  • Twitter