Codex tools: Log in / create account
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.
Install the plugin, From where you came, and if your users clicked the Log in link from your main page, they will be directed back to that page after they login.
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.
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.
See:
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.’) );
}
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
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:
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.
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.
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 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.
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).
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 ?>
To permit images to be uploaded to your site:
From the admin panel, go to Options -> Miscellaneous
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');
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
To turn your comments feature off:
WordPress version 1.2
WordPress version 1.3
WordPress version 2.5
To create password protected text, see Line 19 of wp-includes/template-functions-post.php for that information.
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);
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