rdsmes
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: 404 after save or publish a postjeffparsons –
What’s the URL in the browser on the 404?
Forum: Fixing WordPress
In reply to: 404 after save or publish a postI understand. A lot of hands all working toward the same end – at the same time! We all get there eventually. As for me, I’d never even looked through the bug reports before – maybe I’ll start there next time.
Kudos to Abrazell/Technosailor for the post on his blog and the patch. But we could have used your brain here on this thread over the past couple of days. And that might have saved me the trouble of digging through the code. I could have just let you do it… 🙂
At least we both ended up in the same area as the cause of the problem. Whew!
Forum: Fixing WordPress
In reply to: 404 after save or publish a postOops sorry, I did and added that fact to my previous post. Looks like it works fine, at least in my case. I would hope that a few more folks give it a try and see if it helps them.
I guess it would be nice if the support forums had a bit more insight into what was going on behind the scenes of the bug reports, but that’s a mighty task. Although it looks like this patch had just been suggested very recently, so the submitter was looking at the problem at the same time we were discussing it here.
Forum: Fixing WordPress
In reply to: 404 after save or publish a postWell, just in case folks want to give it a try, the suggested patch in the bug tracking is this:
in wp-includes\functions.php, function update_post_caches (~line 1400 or so), find:
if ( !$posts )
return;and change to:
if ( !$posts || !$posts[0]->ID )
return;This seems to work, and serves the same purpose as my patch did.
Forum: Fixing WordPress
In reply to: 404 after save or publish a postvkaryl –
Thanks for the pointer. It looks like a ticket is already open on this subject – #2498, “faulty “referredby” in write post page” – and a patch has been suggested in the same area of code where I placed mine.
Since it’s already in the bug tracking mechanism, but there is no official resolution or fix for the problem, I’m not sure what options users have at this point other than to try a patch of some sort.
Forum: Fixing WordPress
In reply to: 404 after save or publish a postLike I said in the other thread, I don’t visit this site that much, so I wasn’t sure how to submit bug reports, and I don’t see a link anywhere.
Forum: Fixing WordPress
In reply to: 404 after save or publish a postIf anybody has the guts to try a quick patch / workaround for this problem – for those running maybe a local test server or something like that, you could give this a try:
Edit file wp-includes\functions.php. On line 1413, in the
update_post_cachesroutine, you’ll see:$post_id_list = implode(',', $post_id_array);Add a check after that line, so that it looks like this:
$post_id_list = implode(',', $post_id_array);if (empty ($post_id_list))
return;I’ve run that patch on my test machine now, and it seems to have cleared up the 404 problem that I was able to reproduce on demand by using the ‘save and continue’ button. I’m sure, for the developers out there, that THIS IS NOT the preferred solution. But it may get you up and running.
It’s up to you if you’d like to give it a shot. I can’t guarantee that there won’t be ill effects, but the fix just really detects a condition that was causing a query to fail anyway.
I’ve done about all I can do to pin this one down. I’ll play with this patch for a while and see how it goes.
Forum: Fixing WordPress
In reply to: 404 after save or publish a postOk, here’s the deal on my 404 problem, to the best of my knowledge, for any of the developer types that might want to look into this issue:
I’ve been able to reproduce the problem reliably by starting a new post, then using the ‘save and continue editing’ button. When the page is being generated to send back to my browser, here’s what happens:
1) in edit-form-advanced.php, when generating the ‘referredby’ value, the
url_to_postidfunction is called.2) toward the end of the function, the
url_to_postidfunction generates a new WP_Query object.3) the WP_Query object calls its
get_posts()function.4) After much ado, the
get_postsfunction generates the first mySQL query through a call to$wpdb->get_results()That query IS SUCCESSFUL.5) However, further down in the
get_postsfunction, the resulting$this->postsarray is passed to theupdate_post_cachesfunction.6) In the
update_post_cachesfunction, the $posts array is found to be non-empty. For the next mySQL query, the$post_id_arrayis ‘imploded’ to form the$post_id_list. But the resulting $post_id_list IS EMPTY. When this empty $post_id_list is passed as the parameter for theIN()section of the next mySQL query (comment “Get post-meta info”), mySQL complains (most likely) about the IN parameters being empty. This causes the wpdb object toprint_error, and the output of that print error finds its way all the way back to the beginning of this story, in the ‘referredby’ field of the page sent back to the browser, and ultimately into the redirection URL on a ‘save’ or ‘publish’ operation. That garbage in the URL causes the 404.Forum: Fixing WordPress
In reply to: 404 after save or publish a postAs it happens to me, when I hit ‘publish’, I too am returned to the ‘site’ and get a 404 error since the browser is attempting to access a page that doesn’t exist (because the redirection URL is garbage). But if I click on ‘home’ or go to my site’s home page, I find that the offending post did indeed get published, even though it didn’t “feel” like it did.
Forum: Fixing WordPress
In reply to: 404 after save or publish a postI’m certainly in no position to say that there aren’t multiple problems. I can only speak to the one I’m seeing that I’ve detailed above. And in my case, the posts are actually getting posted, but the browser is redirected to never-never land. That is, in my case, pretty much just an annoyance more than a real ‘problem’.
But since what I’m seeing does seem to be some sort of misconstructed mySQL query, or at least something that is causing the database to throw up an error in complaint, that doesn’t mean that the same or a similar problem can’t or won’t crop up in other usage scenarios. I happened to figure out that I could force the one problem to occur by doing the ‘save-and-continue’, and chose to go down that road since it was very reproducible. And now I’m not sure how much further to go, since I don’t know that much about the WP inner workings with mySQL, and would hesitate to make many changes in that area since it is the heart and soul of the code.
Luckily, I’ve been doing most of the hacking on a local machine, not the machine my site is hosted on.
When looking at Apache, PHP, and MySQL versions, don’t forget to include the Zend Optimizer as well. My hosting company uses Zend, and I have seen it do funny things to parts of the older WP code.
Forum: Fixing WordPress
In reply to: Why does the search function for Support forums suck so badly?Agreed. There does seem to be some sort of problem with the search.
Not to pile on or anything, and the ‘tags’ concept is great, but only seems to work for the first page of results. There are links to more ‘pages’ of entries, but if you try to click to the next pages, those pages don’t have any entries. Disappointing when you’re looking for info on a specific topic.
Forum: Fixing WordPress
In reply to: 404 after save or publish a postIt’s not site crippling by any means – the post mechanism still works fine, it just returns your browser to a non-existent page.
Forum: Fixing WordPress
In reply to: One of my users gets a 404 error when postingI think I’ve narrowed down that problem to the source, at least in the case I’m seeing. I haven’t dug in to figure out how to fix the misbehaving query though. Check the last four posts or so at the thread referred to by Mazalien.
Does anyone have any idea how we get this info into the developers hands? I don’t visit this board that often, so I’m not real familiar with the bug reporting process.
Forum: Fixing WordPress
In reply to: 404 after save or publish a postThe problem is caused by a query done by the
url_to_postidfunction call in the ‘if’ statement on line 212 of wp-admin\edit-form-advanced.php when the ‘save and continue editing’ operation is performed.Since I’m not a mySQL expert by any stretch, I’m not sure what’s wrong with the query.
Forum: Fixing WordPress
In reply to: 404 after save or publish a postMore follow-up – all info here applies to my case, YMMV. The page sent back to the browser after I do a ‘save-and-continue-editing’ operation already has the ‘referredby’ field for the submit button screwed up with the database warning string.
If you are one of the folks seeing this 404 issue – try it: start the browser fresh, and go to the ‘write’ page. Start typing a new post, then hit ‘save and continue editing’. When the edit page refreshes, do a ‘view source’ in your browser. Look for the “input name=referredby”, and take a look at what’s in the ‘value’ field. That’s the error string that is then getting sent in the ‘referredby’ field on the next save or publish operation, and causing the 404 error.
Now we just need to find out why that string is there…