Categories: “File not found” error.
-
I’m using 1.5 (default/Kubrick) to make a quick blog. Everything is fine (as with other WP work), except that when I click on the Category Links (general, and introduction) I get a File Not Found error from both. I can add categories, attach postings to them.. but not see the listings. What seems to be happening is a duplication of the folder name in the URL
http://tomraworth.com/wordpress/wordpress/index.php?cat=1
When I cut and paste the URL deleting one of the “/wordpress”, the listing appears.
Where do I edit to remove the duplication?
-
I’d take a look at categories.php code in you wp-admin directory. I had a similar link related problem with different admin related .php files that merged wp http references with my site references. I solved it simply by editing those .php files.
I appreciate the quick suggestion, but as I don’t really know what I’d be looking for (I just checked) I hesitate to touch anything. My thought was simply that the URL must be composed somewhere, and that a simple deletion would fix it. I’d simply delete the whole category section but that seems impossible… there’s always “general”. Thanks, anyway. TR
I was in the exact same boat. The problem i had was that the url i was looking for didn’t exist anyplace accessible via the wp5 admin interface. By looking at called html references (e.g. for your categories) that pointed me in the right direction, which was to the correct .php files. Can you post up your categories.php code?
Also, Is there anything in your sidebar that suggests this was coded in there? Post that up if you are not sure.
Thanks. Sorry for the delay, offline for a while. Here’s the
categories.php
<?php
require_once(‘admin.php’);$title = __(‘Categories’);
$parent_file = ‘edit.php’;$wpvarstoreset = array(‘action’,’cat’);
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {
if (empty($_POST[“$wpvar”])) {
if (empty($_GET[“$wpvar”])) {
$$wpvar = ”;
} else {
$$wpvar = $_GET[“$wpvar”];
}
} else {
$$wpvar = $_POST[“$wpvar”];
}
}
}switch($action) {
case ‘addcat’:
if ($user_level < 3)
die (__(‘Cheatin’ uh?’));$cat_name= wp_specialchars($_POST[‘cat_name’]);
$id_result = $wpdb->get_row(“SHOW TABLE STATUS LIKE ‘$wpdb->categories'”);
$cat_ID = $id_result->Auto_increment;
$category_nicename = sanitize_title($cat_name, $cat_ID);
$category_description = $_POST[‘category_description’];
$cat = intval($_POST[‘cat’]);$wpdb->query(“INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_description, category_parent) VALUES (‘0’, ‘$cat_name’, ‘$category_nicename’, ‘$category_description’, ‘$cat’)”);
header(‘Location: categories.php?message=1#addcat’);
break;case ‘delete’:
check_admin_referer();
$cat_ID = (int) $_GET[‘cat_ID’];
$cat_name = get_catname($cat_ID);
$category = $wpdb->get_row(“SELECT * FROM $wpdb->categories WHERE cat_ID = ‘$cat_ID'”);
$cat_parent = $category->category_parent;if ( 1 == $cat_ID )
die(sprintf(__(“Can’t delete the %s category: this is the default one”), $cat_name));if ( $user_level < 3 )
die (__(‘Cheatin’ uh?’));$wpdb->query(“DELETE FROM $wpdb->categories WHERE cat_ID = ‘$cat_ID'”);
$wpdb->query(“UPDATE $wpdb->categories SET category_parent = ‘$cat_parent’ WHERE category_parent = ‘$cat_ID'”);
// TODO: Only set categories to general if they’re not in another category already
$wpdb->query(“UPDATE $wpdb->post2cat SET category_id=’1′ WHERE category_id=’$cat_ID'”);header(‘Location: categories.php?message=2’);
break;
case ‘edit’:
require_once (‘admin-header.php’);
$cat_ID = (int) $_GET[‘cat_ID’];
$category = $wpdb->get_row(“SELECT * FROM $wpdb->categories WHERE cat_ID = ‘$cat_ID'”);
$cat_name = $category->cat_name;
?><div class=”wrap”>
<h2><?php _e(‘Edit Category’) ?></h2>
<form name=”editcat” action=”categories.php” method=”post”>
<table class=”editform” width=”100%” cellspacing=”2″ cellpadding=”5″>
<tr>
<th width=”33%” scope=”row”><?php _e(‘Category name:’) ?></th>
<td width=”67%”><input name=”cat_name” type=”text” value=”<?php echo wp_specialchars($cat_name); ?>” size=”40″ /> <input type=”hidden” name=”action” value=”editedcat” />
<input type=”hidden” name=”cat_ID” value=”<?php echo $cat_ID ?>” /></td>
</tr>
<tr>
<th scope=”row”><?php _e(‘Category slug:’) ?></th>
<td><input name=”category_nicename” type=”text” value=”<?php echo wp_specialchars($category->category_nicename); ?>” size=”40″ /></td>
</tr>
<tr>
<th scope=”row”><?php _e(‘Category parent:’) ?></th>
<td>
<select name=’cat’>
<option value=’0′ <?php if (!$category->category_parent) echo ” selected=’selected'”; ?>><?php _e(‘None’) ?></option>
<?php wp_dropdown_cats($category->cat_ID, $category->category_parent); ?>
</select></td>
</tr>
<tr>
<th scope=”row”><?php _e(‘Description:’) ?></th>
<td><textarea name=”category_description” rows=”5″ cols=”50″ style=”width: 97%;”><?php echo wp_specialchars($category->category_description, 1); ?></textarea></td>
</tr>
</table>
<p class=”submit”><input type=”submit” name=”submit” value=”<?php _e(‘Edit category’) ?> »” />
</form>
<?php _e(‘« Return to category list’); ?>
</div>
<?phpbreak;
case ‘editedcat’:
if ($user_level < 3)
die (__(‘Cheatin’ uh?’));$cat_name = wp_specialchars($_POST[‘cat_name’]);
$cat_ID = (int) $_POST[‘cat_ID’];
$category_nicename = sanitize_title($_POST[‘category_nicename’], $cat_ID);
$category_description = $_POST[‘category_description’];$wpdb->query(“UPDATE $wpdb->categories SET cat_name = ‘$cat_name’, category_nicename = ‘$category_nicename’, category_description = ‘$category_description’, category_parent = ‘$cat’ WHERE cat_ID = ‘$cat_ID'”);
header(‘Location: categories.php?message=3’);
break;default:
require_once (‘admin-header.php’);
$messages[1] = __(‘Category added.’);
$messages[2] = __(‘Category deleted.’);
$messages[3] = __(‘Category updated.’);
?><?php if (isset($_GET[‘message’])) : ?>
<div class=”updated”><?php echo $messages[$_GET[‘message’]]; ?></div>
<?php endif; ?><div class=”wrap”>
<?php if ( $user_level > 3 ) : ?>
<h2><?php printf(__(‘Categories (add new)’), ‘#addcat’) ?> </h2>
<?php else : ?>
<h2><?php _e(‘Categories’) ?> </h2>
<?php endif; ?>
<table width=”100%” cellpadding=”3″ cellspacing=”3″>
<tr>
<th scope=”col”><?php _e(‘ID’) ?></th>
<th scope=”col”><?php _e(‘Name’) ?></th>
<th scope=”col”><?php _e(‘Description’) ?></th>
<th scope=”col”><?php _e(‘# Posts’) ?></th>
<th colspan=”2″><?php _e(‘Action’) ?></th>
</tr>
<?php
cat_rows();
?>
</table></div>
<?php if ( $user_level > 3 ) : ?>
<div class=”wrap”>
<?php printf(__(‘Note:
Deleting a category does not delete posts from that category, it will just
set them back to the default category %s.’), get_catname(1)) ?></div>
<div class=”wrap”>
<h2><?php _e(‘Add New Category’) ?></h2>
<form name=”addcat” id=”addcat” action=”categories.php” method=”post”><?php _e(‘Name:’) ?>
<input type=”text” name=”cat_name” value=”” />
<?php _e(‘Category parent:’) ?>
<select name=’cat’ class=’postform’>
<option value=’0′><?php _e(‘None’) ?></option>
<?php wp_dropdown_cats(0); ?>
</select>
<?php _e(‘Description: (optional)’) ?>
<textarea name=”category_description” rows=”5″ cols=”50″ style=”width: 97%;”></textarea>
<p class=”submit”><input type=”hidden” name=”action” value=”addcat” /><input type=”submit” name=”submit” value=”<?php _e(‘Add Category »’) ?>” />
</form>
</div>
<?php endif; ?><?php
break;
}include(‘admin-footer.php’);
?>and here’s the sidebar.php
<?php
$mode = ‘sidebar’;$standalone = 1;
require_once(‘admin-header.php’);get_currentuserinfo();
if ($user_level == 0)
die (“Cheatin’ uh ?”);if (‘b’ == $_GET[‘a’]) {
?><!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<title>WordPress › Posted</title>
<meta http-equiv=”Content-Type” content=”<?php bloginfo(‘html_type’); ?>; charset=UTF-8″ />
<link rel=”stylesheet” href=”wp-admin.css” type=”text/css” />
</head>
<body
Posted !
Click here to post again.
</body>
</html><?php} else {
?><!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<title>WordPress › Sidebar</title>
<meta http-equiv=”Content-Type” content=”<?php bloginfo(‘html_type’); ?>; charset=<?php bloginfo(‘blog_charset’); ?>” />
<link rel=”stylesheet” href=”wp-admin.css” type=”text/css” />
<style type=”text/css” media=”screen”>
form {
padding: 3px;
}
.sidebar-categories {
display: block;
height: 6.6em;
overflow: auto;
background-color: #f4f4f4;
}
.sidebar-categories label {
font-size: 10px;
display: block;
width: 90%;
}
</style>
</head>
<body id=”sidebar”>
<h1 id=”wphead”>WordPress</h1>
<form name=”post” action=”post.php” method=”POST”>
<div><input type=”hidden” name=”action” value=”post” />
<input type=”hidden” name=”user_ID” value=”<?php echo $user_ID ?>” />
<input type=”hidden” name=”mode” value=”sidebar” />
Title:
<input type=”text” name=”post_title” size=”20″ tabindex=”1″ style=”width: 100%;” />Categories:
<span class=”sidebar-categories”>
<?php dropdown_categories(); ?>
</span>Post:
<textarea rows=”8″ cols=”12″ style=”width: 100%” name=”content” tabindex=”2″></textarea><input name=”saveasdraft” type=”submit” id=”saveasdraft” tabindex=”9″ value=”Save as Draft” />
<input name=”publish” type=”submit” id=”publish” tabindex=”6″ style=”font-weight: bold;” value=”Publish” /></div>
</form></body>
</html>
<?php
}
?>Those look clean enough…
For kicks — copy your current sidebar.php content someplace safe where you can retrieve it, and paste this sidebar content over your current sidebar code:
<div class=”sidebar”>
- <!– Activity –>
<h2><?php _e(‘Activity’); ?></h2>
<!–This will show the last 10 posts, including the last one. To change the number of post shown
edit the ‘nuberposts=x’ to whatever value you want, and to skip the last one (or last 2, 3, etc.)
increase the value of ‘offset=x’ (default is “0” so it will start by the last post)–>
- <?php
- ” title=”<?php the_title() ?>”><?php the_title() ?>
$posts = get_posts(‘numberposts=10&offset=0’);
foreach ($posts as $post) :
?><?php
endforeach;
?><!– End of Activity –>
<!– Pages Just uncomment if you want a list of pages in the frontpage- <h2><?php _e(‘Pages’); ?></h2>
-
<?php wp_list_pages(‘title_li=’); ?>
–>
- <!– Archives –>
<h2><?php _e(‘Archives’); ?></h2>
-
<?php wp_get_archives(‘type=monthly’); ?>
<!– End of Archives –>
- <!– Categories –>
<h2><?php _e(‘Categories’); ?></h2>
-
<?php wp_list_cats(‘optioncount=0’); ?>
<!– End of Categories –>
<?php if ( is_home() ) { ?>
<?php if (function_exists(‘wp_theme_switcher’)) { ?>- <!– Theme switcher –>
<h2><?php _e(‘Themes’); ?></h2>
<?php wp_theme_switcher(); ?> - <!– Feeds –>
<h2><?php _e(‘Feeds’); ?></h2>
<!– End of Theme switcher –>
<?php } ?>- ” title=”RDF/RSS 1.0 Feed”>RDF/RSS 1.0
- ” title=”RSS 0.92 Feed”>RSS 0.92
- ” title=”RSS 2.0 feed”>RSS 2.0
- ” title=”Atom feed”>Atom
- ” title=”Comments RSS 2.0 Feed”>Comments [RSS 2.0]
<!– End of Feeds–>
- <!– Meta –>
<h2><?php _e(‘Meta’); ?></h2>
-
<?php wp_register(); ?>
- <?php wp_loginout(); ?>
- Valid XHTML
- XFN
- WordPress
<?php wp_meta(); ?>
<!– End of Meta –>
<?php } ?></div>
Does the problem still happen? If not, its your sidebar code. Start tweaking my code in for yours. If it still happens, just copy the saved code from your backup and restore it to its original.
Beyond that, for now…. Someone offered this to me with my problem — for me it did not work, but it was worthing checking out. Maybe it will help:
“For the dodgy blog, use this page to check the “site_url” and “home” values.
http://www.tamba2.org.uk/wordpress/site-url/”Thanks again: but no change, so sidebar.php is back as it was. I looked at tamba’s page, but I’ve no idea what I’d be changing the value “to”… so I won’t tamper there. Too tired to think more tonight. Your patient help is appreciated. TR
The site URL is
http://tomraworth.com/wordpress
if you mouse over the “general” and “introduction” links in Categories you’ll see the problem.
Goodnight
- <!– Activity –>
- The topic ‘Categories: “File not found” error.’ is closed to new replies.