FAQ Working with Wordpress
Administration
Can my posts have titles instead of /index.php?p=76?
See:
How can I find out if I have mod_rewrite?
To get information about your server, you can use the PHP Info function:
- Paste this into a new Notepad / BBEdit file
<?php phpinfo(); ?>
- Save as info.php
- Upload to server. Visit in your browser (www.example.com/info.php)
That will give you info about your php version and .
The info.php file returns a page outlining the details of your PHP installation. You can see if mod_rewrite is loaded. Under the apache header, look in the Loaded Modules section and see if mod_rewiite is listed.
How do I change file and folder permissions?
See:
Why are the version numbers not in any particular periodic sequence?
The version number for improved versions of WordPress might not follow a strictly monotonic or periodic numerical (or in the case of test releases, alphabetical) sequence, since the version numbers reflect relative progress, and the changes made to existing or previous versions. So, for example, since v1.2 is a majorly revamped version of v1.0 (with about 60% of the code having been touched), 1.1 was ’skipped’ along the way.
How do I turn on Permalinks, and what do I do about the errors?
See:
What are User Levels for and what permissions do different User Levels have?
See:
Roles and Capabilities replaces the concept of User Levels in newer versions of WordPress.
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.
How do I redirect users back to my blog’s main page after they login?
Install the plugin, , and if your users clicked the Log in link from your main page, they will be directed back to that page after they login.
How do I change permissions for my files so I can edit them using the Template Editor?
See:
How do I prevent my images from being hot-linked by another website?
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.
provides more details.
You can use this tool to check if the images are protected properly, and that has a few extra tips too.
For a more sophisticated method of preventing hotlinking see .
How do I backup and restore my WordPress database using phpMyadmin?
See:
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. article, , and the related , allows you set a time interval between each comment to prevent successive comments from being posted too soon.
A copy of the code modification is given below (this is for WP 1.2) :
In wp-comments-post.php (between the comments, you should recognize the place), add the following:
// Simple flood-protection
$lasttime = $wpdb->get_var("SELECT comment_date FROM $tablecomments ORDER BY comment_date DESC LIMIT 1″);
if (!empty($lasttime)) {
$time_lastcomment= mysql2date(’U', $lasttime);
$time_newcomment= mysql2date(’U', $now);
if (($time_newcomment - $time_lastcomment) < 300)
die( __(’Sorry, this blog only allows a new comment once every 300 seconds. If you really want to write a comment,
just wait a few and hit refresh on this page. Chances are you tried to add a comment about halfway between 0 and 300 seconds.
Comment flooders are annoying. Thank you for being patient.’) );
}
Why can’t I delete the uncategorized Category?
Any Category with a non-zero value for # of Posts in the >
> cannot be deleted. The uncategorized Category might be assigned to some Posts, but all 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.
Why is there no Page Template option when writing or editing a Page?
If there is no Page Template option when writing or editing a it may because there is no with the proper structure. For the Page Template box to be available to assign to a there must be a least one template file in your theme that has a structure at the beginning of the template file that looks like this:
<?php /* Template Name: Links */ ?>
That example is from the WordPress Default themes wp-content/themes/default/links.php file, so replace Links with your desired template name.
Note: Sometimes it is necessary to switch to the WordPress Default Theme, then back to your theme, for the Template choices to appear!
See also:
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 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 > > 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 , and fit it to meet your needs:
-
- With the help of the article, determine what is normally used to display your (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 > > , edit the myfront.php and change the beginning of the file from:
<?php /** * @package WordPress * @subpackage Default_Theme */
to:
<?php /* Template Name: MyFront */ ?>
-
- Then access the Page called Front in > > 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’:
<?php
/*
Template Name: MyFront
*/
?>
<?php get_header(); ?>
<div id="content" class="narrowcolumn">
<?php
query_posts('p=1'); //set p=x where x is post id of post you want to see or use query_posts('cat=1&showposts=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 »'); ?>
</div>
<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>
</div>
<?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>
</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; ?>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
See:
Configuration
How can I change how the date and / or time is displayed?
See:
How can I control comments people make?
See:
What do the Discussion Options mean?
See:
How do I install plugins?
See:
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(' • ') ?>
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.
Why are all the comments being moderated?
Go to the > 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.
How do I stop people from posting HTML in comments?
Acceptance of HTML tags in the comments field is managed in the file kses.php, located in the wp-includes folder.
Open this file in a text editor, and locate the list of HTML tags near the top of the file. Each HTML tag is listed on a separate line, in the construction of a PHP array of allowed tags. Lines which begin with // are commented-out, or disabled, so lines which begin with // designate HTML tags that are not allowed in comments.
To stop people from posting HTML in comments, edit your kses.php file as desired to allow or disallow specific HTML tags in comments, by adding // to the very beginning of the appropriate lines of the list. To exclude all HTML tags, comment out all lines which allow HTML tags. Be sure to save your file when done.
Note that while you could simply delete the lines instead of commentng them out, by adding // at the start of the line you achieve the same result, while preserving the list of tags for possible re-enabling at a later date.
How do I disable comments?
First, unchecked Allow people to post comments on the article on the > panel. This will only disable comments on future posts. Now, to completely disable comments, you will have to edit each past post and uncheck Allow Comments from the . Alternatively, you could run this MySQL query from the command line on a shell account or using : UPDATE wp_posts SET comment_status="closed";
If your goal is to permanently disable comments, then you should delete the wp-comments-post.php file as well.
How do I disable trackbacks and pingbacks?
First, unchecked Allow link notifications from other Weblogs (pingbacks and trackbacks.) on the > panel. This will only disable trackbacks and pingbacks on future posts. Now, to completely disable trackbacks and pingbacks, you will have to edit each past post and uncheck Allow Pings from the Write Post SubPanel. Alternatively, run this MySQL query from the command line on a shell account or using PHPMyAdmin: UPDATE wp_posts SET ping_status="closed";
If your goal is to permanently disable trackbacks and pingbacks, then you should delete the wp-trackback.php file as well.
How do I disable my RSS or syndicated feeds?
To disable your RSS or syndicated feeds, you must delete the wp-atom.php, wp-commentsrss2.php, wp-feed.php, wp-rdf.php, wp-rss.php, and wp-rss2.php files.
This might only work with older versions though! I found the feeds still worked until I removed the wp-includes/feed-*.php files as well. Requests for a feed now return an error, which is inelegant, but does the trick.
How do I change the site admin name?
To change your Admin Name, in the , choose the Users->Your Profile tab. Make your changes there. However, you are not able to change the username from within the Administration panel. In order to do this you must directly edit the MySQL database, however this is not recommended as your username is not often seen by other users.
See:
How do I find the absolute path I need for uploading images?
To find the absolute path of a page, will help you. Download, unzip, ftp to the location of the page / image / directory and then call the file in your browser –
Which files do I change to alter the way my blog looks?
The following files affect the public display of your site, and each can be easily changed by using the Built-in Editor from the Templates option in your admin screen:
* index.php
This affects the layout of your content.
* style.css
This is how the style and presentation of your blog is controlled.
* wp-comments.php
This controls the layout of user-submitted comments and trackbacks,
and the comments submission form.
* wp-comments-popup.php
Only needed if you decide to use a popup comments box.
(Popup comments are off by default).
Can I have popup comments?
To enable popup comments, choose the appropriate method for the version of WordPress you are using.
WordPress version 2.0 Default Theme
Inside header.php add this line:
<?php comments_popup_script(); ?>
above this line:
<?php wp_head(); ?>
For example:
<?php comments_popup_script(); ?> <?php wp_head(); ?> </head>
WordPress 2.0 Classic Theme
In the file header.php locate this line (line 21):
<?php //comments_popup_script(); // off by default ?>
And remove the first comment markers, changing it to this:
<?php comments_popup_script(); // off by default ?>
WordPress version 1.5 Default Theme
Inside header.php add this line:
<?php comments_popup_script(); // off by default ?>
below this line:
<?php wp_get_archives('type=monthly&format=link'); ?>
Example:
<?php wp_get_archives('type=monthly&format=link'); ?>
<?php comments_popup_script(); // off by default ?>
<?php wp_head(); ?>
WordPress version 1.5 Classic Theme
Inside header.php is this line:
<?php //comments_popup_script(); // off by default ?>
Change that to
<?php comments_popup_script(); // off by default ?>
WordPress version 1.2
Inside index.php is this line:
<?php //comments_popup_script(); // off by default ?>
Change that to
<?php comments_popup_script(); // off by default ?>
How do I upload images?
To permit images to be uploaded to your site:
From the admin panel, go to Options -> Miscellaneous
- Select the option to Allow File Uploads
- If you need help with finding the absolute path, see How do I find the absolute path I need for uploading images?.
- If you need help with changing permissions, visit .
Can I change where the WordPress Database Plugin saves the backups?
Currently (as of WordPress 2.0) the WordPress Database Plugin saves the backups in the folder wp-content/backup-xxxxxx (where xxxxxx is a randomly generated sequence). To change the folder used, change the wp-db-backup.php file.
In Version 1.7 of the WordPress Database Plugin you would change line 22 of wp-db-backup.php where it says
define('WP_BACKUP_DIR', 'wp-content/backup-' . $rand);
to something like:
define('WP_BACKUP_DIR', 'mydir/mysubdir');
Modifying
Can I change the Smilies?
See:
How do I edit files?
See:
What is The Loop?
See:
How can I change the URL-structure for my posts?
See:
How can I change URL-structure for my posts on a Windows server?
See:
How do I use WordPress Template Tags to change what is displayed on the blog?
See:
How do I get All links to open in a new window?
Put this inside the <head> section of your Theme’s file:
<base target="_blank" />
See:
How can I add an image to my RSS feed?
See:
How can I stop my own comments being mailed to me?
WordPress version 1.2
This will stop WP from sending you a mail if the email address you used when you posted the comment was the same as the email address for the author of the post (which is the address the notification email gets sent to). This applies to v1.2 / 1.2.1 code ONLY.
In functions.php change the following line:
if ( == $user->user_email) return false; // If there's no email to send the comment to
to
if ( == $user->user_email || $comment->comment_author_email == $user->user_email) return false; // If there's no email to send the comment to
If I turn off comments, it says “Comments Off” on the weblog. so how do I change that?
To turn your comments feature off:
WordPress version 1.2
- Line 58 of wp-includes/template-functions-comment.php has the words ‘Comments Off’
WordPress version 1.3
- Line 98 of wp-includes/template-functions-comment.php has the words ‘Comments Off’
WordPress version 2.5
- Line 720 of wp-icludes/comment-template.php has the words ‘Comments Off’ as the value of the variable $none (in the comments_popup_link function)
How do I change what is shown when I password protect a post?
To create password protected text, see Line 19 of wp-includes/template-functions-post.php for that information.
How can I allow certain HTML tags in my comments?
WordPress versions prior to 1.2
If you would like to override the $allowedtags variable in kses.php you may do so in your my-hacks.php file, provided you add the following code after you set up the $allowedtags array.
define('CUSTOM_TAGS', true);
How can I add advanced search ability to WordPress?
See:
Posts
How do I upload an image and display it in a post?
- More recent versions of WordPress
More recent verions of WordPress allow uploads while writing posts by using the “Upload/Insert” or “Add Media” buttons found across the top of the posting panel on the new post screen (See Using Image and File Attachments). You can control where images are stored through the Miscellaneous panel in Settings.
- From Administration > Settings > Miscellaneous
- Make sure the correct information, such as wp-content/uploads is in Store uploads in this folder.
- Don’t forget to decide if you want to Organize my uploads into month- and year-based folders by checking that setting.
- In older WordPress versions
To permit images to be uploaded to your site:
- From the
- Select the option to Allow File Uploads
- Then check main menu across the top. Click Upload
Refer to the following articles to align the image in the post:
See:
What is pingback?
See:
What is trackback?
See:
Where is the permalink to my post?
See:
Can I use desktop blogging software?
See
Can I blog by email?
See
Spam, Spammers, Comments
What can I do to stop comment spam?
See:
More Information on Comment Spam
See:
What Spam words do I need?
See:
Why are all the comments being moderated?
If you are getting all comments sent to moderation when they should not, it’s probably your spam words list in Administration Panel->Options -> Discussion. It probably has either a single character, OR a blank line OR extra whitespace. Take those out.
Right click in the Spam Words box, Select All then Copy and paste it into Notepad to check it.
With spam plugins adding to that list, it’s not easy to check for odd data, and it’s easy to miss multiple blank lines. This way makes it easier.
Check it carefully :)
Importing and Exporting
How do I Import a WordPress WXR file when it says it is too large to import?
If a WordPress WXR file, an XML file exported from WordPress, is too large to import, there are several things you might try to overcome that limit.
- Increase the amount of memory a PHP script may consume. Note: If using a shared hosting service, you may need to ask your host to increase the limit.
-
- Increase the memory limit setting in php.ini (e.g. memory_limit = 64M ;). Many hosts may not allow this.
- Increase the memory limit via .htaccess (e.g. php_value memory_limit 64M). Many hosts may not allow this.
- Increase the memory limit via wp-config.php (e.g. define('WP_MEMORY_LIMIT', '64MB');)
- Increase the maximum amount of a time a PHP script will run. Note: If using a shared hosting service, you may need to ask your host to increase the limit.
-
- Increase the maximum execution time in php.ini (e.g. max_execution_time = 600 ;). Many hosts may not allow this.
- Increase the PHP upload files size settings. Note: If using a shared hosting service, you may need to ask your host to increase the limit.
-
- Increase the setting values in php.ini (e.g. upload_max_filesize = 64M ; and post_max_size = 64M ;). Many hosts may not allow this.
- Increase the setting values via .htaccess (e.g. php_value upload_max_filesize 64M and php_value post_max_size = 64M). Many hosts may not allow this.
- Increase the setting values via ini_set lines in wp-config.php. Talk to your host for the correct values.
- Increase the file upload size limit and/or file upload space limit:
-
- Login to wp-admin as an administrator.
- In the Site Admin navigation box, click “Options”
- Scroll down and change the settings for “Max upload file size” and/or “Blog upload space”
- GZip the file. On some hosting services, a gzipped file can be automatically expanded in the background, without WordPress ever knowing the difference. This can allow you to make the file small enough to be fit into the maximum upload size constraints.
-
- On Windows, use 7Zip to create a gz archive out of the wxr file.
- On Linux, use the gzip command line.
- Make sure that the resulting file has the file extension of “.gz” before uploading it, as this is often necessary.
- This is not guaranteed to work, as it highly depends on the hosting configuration. If this fails, then try another method instead.
- Break the WordPress WXR file into smaller pieces by separating the data between posts and pasting the header/footer into each file.
-
- 1. Always have the header
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:wp="http://wordpress.org/export/1.0/" > <channel> including all info like category, tags, etc to just before the first <item>
-
- 2. Always have the footer
</channel> </rss>
-
- 3. In between, add the posts start with <item> end with </item> and check to see whether the XML file you’re creating is less than or equal to 2MB. You’ll get the hang of it.
-
- 4. As always, before importing the new XML’s, backup the database of the blog you are importing the XML files to and might as well export XML file of that blog as well for good measure.
See:
How do I import links (blogroll) from another WordPress blog?
To import links (also called blogroll) from another WordPress blog is very easy. This assumes you have an ‘old’ blog where the links currently are stored, and a new blog where you want to import the links.
- Visit . Then use SAVE AS to save the output, then use > Blogroll to import the file you saved.
or
- Use > > > Blogroll at your new blog, and enter in the Specify an OPML URL: field.



