• techzeesite

    (@techzeesite)


    I am currently having a problem on WordPress search page feed link. Like I have redirect the “search” page to “news” page. I mean

    The search page was

    https://example.com/search/Barack+Obama/

    I have redirect it to

    https://example.com/news/Barack+Obama/

    Now in search page the rss feed link still showing the “search” in url

    https://example.com/search/Barack+Obama/feed/rss2/

    How do I change it like below or Is it possible to do replace the feed link?

    https://example.com/news/Barack+Obama/feed/rss2/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    The link is probably part of your theme. Which theme are you using?

    Thread Starter techzeesite

    (@techzeesite)

    @ Andrew Nevins

    Actually i have created a custom theme.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    What is the code of that link?

    Thread Starter techzeesite

    (@techzeesite)

    That is the code i have used
    page name: template-news.php

    <?php
    /**
     * Template Name: News Search Page
     *
     */
    
    get_header();
    
    ?>
    
        <div class="main_content">
            <div class="category_header">
                <div class="row">
                    <div class="col-sm-12">
                        <div class="custom-breadcrumb">
                            <h1>News Digest</h1>
                            <?php
                            schema_breadcrumb();
                            ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    
        <div class="container container-most">
    
            <div class="row">
    
                <?php
                if ( have_posts() ) :
                    // Start the loop.
                    while ( have_posts() ) : the_post();
                        get_template_part( 'content', '' );
    
                        // End the loop.
                    endwhile;
    
                    // Previous/next page navigation.
                    global $wp_query;
    
                    $big = 999999999; // need an unlikely integer
    
                    $pages = paginate_links( array(
                        'base'          => get_pagenum_link(1) . '%_%',
                        'format'        => '/?paged=%#%', // ?page=%#% : %#% is replaced by the page number
                        'prev_next'          => true,
                        'prev_text'          => __('<span aria-hidden="true">&laquo;</span>'),
                        'next_text'          => __('<span aria-hidden="true">&raquo;</span>'),
                        'current' => max( 1, get_query_var('paged') ),
                        'total' => $wp_query->max_num_pages,
                        'type'  => 'array',
                    ) );
                    if( is_array( $pages ) ) :
                        $paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged');
                        echo '<div class="col-sm-12"><nav aria-label="Page navigation" style="text-align: center;"><ul class="pagination">';
                        foreach ( $pages as $page ) {
                            echo "<li>$page</li>";
                        }
                        echo '</ul></nav></div>';
                    endif;
                // If no content, include the "No posts found" template.
                else :
                    get_template_part( 'content', 'none' );
                endif;
                ?>
    
            </div>
    
        </div>
    
    <?php
    get_footer();
    ?>
    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    I’m afraid there isn’t an RSS link in that code.

    Thread Starter techzeesite

    (@techzeesite)

    There is no rss code I have used. Can you please read my question for one time for me.

    search page showing the rss feed link like below
    https://example.com/search/Barack+Obama/feed/rss2/
    How do I change it like below or Is it possible to do replace the feed link?
    https://example.com/news/Barack+Obama/feed/rss2/

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    When you say “link” do you mean “url”?

    Thread Starter techzeesite

    (@techzeesite)

    yup buddy

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Now in search page the rss feed link URL still showing the “search” in url

    Are you saying you have an RSS feed just for the search page? If so, is that generated from a plugin? Which?

    Thread Starter techzeesite

    (@techzeesite)

    no buddy its generating automatically.

    search page showing the rss feed url like below
    https://example.com/search/Barack+Obama/feed/rss2/
    How do I change it like below or Is it possible to do replace the feed url for the search page as below?
    https://example.com/news/Barack+Obama/feed/rss2/

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Is it possible to replace the search page rss feed link in WordPress?’ is closed to new replies.