Codex tools: Log in
Languages: English • 中文(简体) • 中文(繁體) • (Add your language)
See:
To get information about your server, you can use the PHP Info function:
<?php phpinfo(); ?>
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.
See:
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.
See:
See:
Roles and Capabilities replaces the concept of User Levels in newer versions of WordPress.
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.
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.
See:
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.
See:
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);
Creating plugins can be very easy, the above code actually has most of the work done for you.
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.
If there is no Page Template option when writing or editing a Page it may because there is no template file with the proper structure. For the Page Template box to be available to assign to a Page 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:
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:
If you want to further customize your front page, you can create a Template, and fit it to meet your needs:
<?php /** * @package WordPress * @subpackage Default_Theme */
to:
<?php /* Template Name: MyFront */ ?>
<?php
/*
Template Name: MyFront
*/
?>
<?php get_header(); ?>
<div id="content" class="narrowcolumn">
<?php
$args = array('posts_per_page' => 1, 'cat' => 1);
$the_query = new WP_Query( 'posts_per_page=1','cat=1' );
$the_query = new WP_Query( $args );
// The Loop
while ( $the_query->have_posts() ) :
$the_query->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 wp_reset_postdata(); ?>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
See:
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:
See:
See:
See:
See:
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.
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.
First, unchecked Allow people to post comments on the article on the Options > Discussion 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 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.
First, unchecked Allow link notifications from other Weblogs (pingbacks and trackbacks.) on the Options > Discussion 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.
To change your Admin Name, in the Administration Panel, 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:
To find the absolute path of a page, absolutepath.zip will help you. Download, unzip, ftp to the location of the page / image / directory and then call the file in your browser - http://www.example.com/images/absolutepath.php
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).
Be aware that if the theme you modify is updated, your modifications will be overwritten. To better organize your modifications and protect them from updates, consider creating a Child Theme in which to keep all your modifications.
Yes, but how to enable it and where is theme dependent. For your main page's comments links, converting them to a popup style is typically just a matter of adding the function call comments_popup_script() to your headers.php template <head> section. The best place to add it is just above the wp_head() call that should be right at the end of the <head> section.
<?php comments_popup_script() ?> <?php wp_head(); ?> </head>
You will also need the comments-popup.php template in your theme folder. If you don't have one, you can download an older version of WordPress from the release archive and extract it from the zip file. It will be in the default theme folder, the 2.7 version should do the trick.
If you want popup links on the single listing page as well, you'll need to locate the comments_template() call for the current comments, usually on the single.php template. Comment that call out and insert comments_popup_link(); right above it.
<?php comments_popup_link(); ?> <? /* php comments_template( '', true ); */ ?>
To permit images to be uploaded to your site:
From the admin panel, go to Options -> Miscellaneous
Just simply create a file to reside at wp-content/db-error.php, and in that file put the message you want displayed to users when WordPress determines the database connection is not available. That file will be used in place of "Error establishing database connection" message. You could even use the db-error.php to redirect users elsewhere. Here's an example for db-error.php:
<?php echo '<h2> This site is currently experiencing a problem with the database server.</h2> Press your browser Reload button to try again!'; ?>
See:
See:
See:
See:
See:
See:
Put this inside the <head> section of your Theme's template header.php file:
<base target="_blank" />
See:
See:
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
Depending on your theme, some other message of similar intent may be displayed. The specifics of how to remove this message is theme dependent. You should be able to find the offending text in your theme's comments.php file. If it's displayed by a PHP function, comment out the function with slash-asterisks '/*' and '*/' (without quotes) on either end of the function:
<?php /* _e( 'Comments are closed.' , 'twentytwelve' ); */ ?>
If it's simply HTML, comment out the enclosing HTML tags by adding '!-- ' after the first angle bracket and ' --' before the last angle bracket (not including the quotes, note the space after the first and before the last comment symbols):
<!-- p class="nocomments">Comments are closed.</p -->
If you decide later to restore the message, you can simply remove the comment symbols.
Hook the filters 'the_title' and 'the_password_form'. Your filter function is passed exactly what the filter names imply. Use the str_replace() function to search out the offending text and replace it with your preference (or nothing). Note the 'the_title' filter fires for every single title, not just password protected posts, so you need to use the existence of the post_password property to know whether to apply the string replace function or not. Some themes may also have additional locations where content needs to be changed. For example, the twentyeleven theme requires a phrase to be changed on the comments.php template.
add_filter('the_title', 'replace_protected', 10, 2);
function replace_protected( $title, $id ) {
$post = get_post( $id );
if ( ! empty( $post->post_password ) ) {
$title = str_replace('Protected:', 'Hidden:', $title);
}
return $title;
}
add_filter('the_password_form', 'replace_message');
function replace_message( $form ) {
return str_replace('This post is password protected. To view it please enter your password below:',
'Enter you password below to see the surprise:', $form);
}
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);
Later WordPress versions
Use a custom filter in your themes functions.php or plugin as explained here:
add_filter('preprocess_comment','fa_allow_tags_in_comments');
function fa_allow_tags_in_comments($data) {
global $allowedtags;
$allowedtags['span'] = array('style'=>array());
$allowedtags['p'] = array();
return $data;
}
See:
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.
To permit images to be uploaded to your site:
Refer to the following articles to align the image in the post:
See:
See:
See:
See:
See
See
See:
See:
See:
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 :)
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.
<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>
</channel> </rss>
See:
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.
or