Support » Fixing WordPress » comment redirect script?

  • Heres my basic setup, Ive got my main index showing one category, and on other sections of my site I am showing a single post by id on those indexes.

    the problem comes in when I comment on a section of the site that has the post by id, after you click “say it” you are taken to the main index where that post is displayed with the comment, rather than staying on the index in the directory I put it.

    simple example, my “feature” section of my site displays one post by id, now this section has a 2 column layout. so you comment on the entry, hit “say it” and you are taken to my main site page index which is set up to display one category and has a 3 col layout, and where now no posts from that category appear only the one that you just commented on from the 2 col layout. I dont want it to go to the main index to display.

    everything works great until you hit “send it”

    is there a way to write the comment script so that it stays where its at and doesnt go to the main index to display the post and comment?

    maybe a redirect to the url of the index it originated from?

    I cant use pages for this as I need all the functionality and the entries have to be included in the rss…..

    thanks in advance…

Viewing 10 replies - 1 through 10 (of 10 total)
  • I don’t really know the solution, but I guess it has to do something with this line in your comments.php file:
    <input type="hidden" name="redirect_to" value="<?php echo wp_specialchars($_SERVER['REQUEST_URI']); ?>" />

    hey moshu, thanks I figured that was what was doing it, I just dont know how to write it to do what I need…

    Im in a rock and a hard place here, as I need the sections of the site to be included in my rss, so I wanted to go with categories, but this redirect is keeping me from setting up my site that way.

    If i do pages then none of it gets into my rss, (i know of the way of adding a page to the rss feed, but the restrictions on naming and the lack of it updating on new pages keeps me from going this route and thats a major shot in my foot, as these sections will contain articles and features that are actually more important than anything on the main index.

    The last dreadful scenario is to install wordpress in each of those sections, which I cant bear doing…

    This has stumped development on my site, Id really appreciate it if someone could help me out with the comment redirect script or anything else that could be of assistance….

    thanks alot…

    resorting to a bump :/

    without seeing your site, hard to tell exactly what you are doing (new users should set their URL in their profile, helps us look into things easily…).

    I’d probably say there are two approaches:

    1. use pop-up comments. then there’s no redirect.

    2. show us the site, as it is likely the case that there is a bad redirect occurring. it should redirect you to the page you were on, not somewhere else. But that wholly depends on your theme, and how much customizing/hackery you have already done to separate out your category/section stuff. Possible you have some bad code somewhere that isn’t doing the right redirect — hard to say sight unseen.


    ok thanks dave, pop ups are not something I want to use,

    this site is not something ready for the public, so its not something i’ll post here…

    for the two column indexes as I mentioned above i’m using display by post id:

    /* Don't remove this line. */
    $blog = 1;
    if (!isset($p)) {
    $p = 7;

    the only other thing I can think of is that I am using a base href for the entire site, but removing that to test has no effect on this comment redirection, it does the same with or without the base href.

    this is the action code on the form:
    <form action="<?php echo get_settings('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">

    and I havent touched my wp-comments-post.php from the strayhorn install….

    but to reiterate, commenting on this index displays the entire post and comments on the main index (3 col) rather than the index in this directory.

    oy, still bangin away at a solution for this…if someone could lend me a hand id be real thankful, if you want to see it in “inaction” you can email me and I’ll send you the link.. thanks alot…

    cfanyc at gmail dot com

    the more I think about this the worse it gets, say I get the comment script working correctly. When I impliment my archives page, and someone clicks on an entry thats an article or feature( 2 column) post, then they will be displayed again on the main index (3 col) as thats the url of the permalink… thats the same problem.

    If I go with pages, then there is no rss support and the only archives I can get with pages, is to get pages which will not make any differentiation of the post whether its an article or a feature as pages have no categories. only way around that is to give each article post and feature post specific titles “article-blah blah” “feature-blah blah” then when the pages archive is listed that will appear to show the difference.

    Last resort is 3 wordpress installs. 1) main 2) features 3) articles.
    which will require 3 rss feeds, 3 versions of wp to upgrade, no site wide searches, and no site wide archives, or anything else sitewide for that manner. what I gain is more control over content management, but thats it…

    I have been giving it my all to go with wordpress on this project and basically refuse to give up, but its not looking good..

    thought i’d NEVER say this but its times like this that i miss MT…this would not even be an issue

    could conditional tags be my help ???

    hope hope

    heh nothing like a convo with yourself….

    I really think this may do what I need?

    for individual posts, ryans plugin:

    custom post templates

    and Kafkaesquis for categories:

    custom posts categories templates

    given my situation am I looking in the right direction? will both of these work with rss and function like any other post?

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘comment redirect script?’ is closed to new replies.