常见问题集:关于 WordPress

Back to FAQ


Can my posts have titles instead of /index.php?p=76?编辑


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 (

That will give you info about your php version and mod_rewrite.

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?编辑


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?编辑


What are User Levels for and what permissions do different User Levels have?编辑


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 to the index.php page after the login from wp-login.php?编辑

In wp-login.php find the following line of code :

<input type="hidden" name="redirect_to" value="wp-admin/" /></input>

and change that to

<input type="hidden" name="redirect_to" value="index.php" /></input>

If your weblog is set up to have the index page in a different directory from the WordPress files, then you will have to replace index.php in the above line of code with the relative path (with respect to wp-login.php) of the blog’s index page to make this work.

This will redirect users to the index.php page instead of the wp-admin/index.php page after they log in.

How do I change permissions for my files so I can edit them using the Template Editor?编辑


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.

Clockwatchers’ htaccess image guide 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 A List Apart's Smarter Image Hotlinking Prevention.

How do I backup and restore my WordPress database using phpMyadmin?编辑


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. Mark Ghosh's article, Comment flood prevention-a really simple solution, and the related Comment flood prevention hack, 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 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. 975955279902366263508491

配置 编辑

How can I change how the date and / or time is displayed?编辑


How can I control comments people make?编辑


At present, Dubai is a should see vacationer vacation spot for everyone. It is known as the paradise on earth. In case you are within the city for a enterprise trip then do not miss the opportunity to have enjoyable with the Escort Dubai. These escorts with their tempting look are the perfect for social events as effectively. Why are you ready then? Go browsing to the relevant website and dig out the detailed info. You will undoubtedly cherish those lovely moments spent in the firm of these fantastic individuals.

How do I install plugins?编辑


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.

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.

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 Options > Discussion panel. This will only disabled comments on future posts. Now, to completely disable comments, you will have to edit each past post and uncheck Allow Comments from the Write Post SubPanel. Alternatively, you could run this MySQL query from the command line on a shell account or using phpMyAdmin: 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 Options > Discussion panel. This will only disabled 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.

How do I change the site admin name?编辑

To change your Admin Name, in the Administration Panel, choose the Users->Your Profile tab. Make your changes there.


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(); ?>

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'); ?>


<?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

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');

修改 编辑

Can I change the Smilies?编辑


How do I edit files?编辑


What is The Loop?编辑


How can I change the URL-structure for my posts?编辑


How can I change URL-structure for my posts on a Windows server?编辑


How do I use WordPress Template Tags to change what is displayed on the blog?编辑


How do I get All links to open in a new window?编辑

Put this inside the <head> section of your Theme's template header.php file:

<base target="_blank" />


How can I add an image to my RSS feed?编辑


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


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'

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?编辑



How do I upload an image and display it in a post?编辑

To permit images to be uploaded to your site:

  • Then check main menu across the top. Click Upload

Refer to the following articles to align the image in the post:


What is pingback?编辑


What is trackback?编辑


Where is the permalink to my post?编辑


Can I use desktop blogging software?编辑


Can I blog by email?编辑


垃圾, 评论 编辑

What can I do to stop comment spam?编辑


More Information on Comment Spam编辑


What Spam words do I need?编辑


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 :)

Back to FAQ