Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7080837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:50:40+00:00 2026-05-28T06:50:40+00:00

I am working on my Page not found 404 template. For some reason my

  • 0

I am working on my Page not found 404 template. For some reason my conditional doesn’t seem to work right:

What I am trying to achieve is to break down the path and search for each expression.
I remove – and _ from the expression.

$s = preg_replace("/(.*)-(html|htm|php|asp|aspx)$/","$1",$wp_query->query_vars['name']);
            $posts = query_posts('post_type=any&name='.$s);
            $s = str_replace("-"," ",$s);
            $s = str_replace("_"," ",$s);
            if (count($posts) == 0) {
                $posts = query_posts('post_type=any&s='.$s);
            }
            if (count($posts) > 0) {
                echo "<ol><li>";
                echo "<p>Were you looking for <strong>one of the following</strong> posts or pages?</p>";               
                echo "<ul>";
                foreach ($posts as $post) {
                    echo '<li><a href="'.get_permalink($post->ID).'">'.$post->post_title.'</a></li>';
                }
                echo "</ul>";
}

If I type “products_s”

It says:

in Let me help you find what you came here for: Were you looking for
one of the following posts or pages?
Products

So It finds products, which is great.

But if i type in “products_services”

Even though I am expecting to get products and services pages listed as above, it doesn’t finds anything.

What am I missing?

Thanks,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:50:40+00:00Added an answer on May 28, 2026 at 6:50 am

    I have never used wordpress but I do notice you change the queryposts()

    In the first check you do:

    $posts = query_posts('post_type=any&name='.$s); //notice &name=

    In the second check you do:

    $posts = query_posts('post_type=any&s='.$s); // notice &s=

    It all depends what is happening inside of queryposts(). Personally I would just pass the string through with ‘_’ ‘-‘ and explode('-',$string) on the other side to split them into an array.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Why is this not working, as in the pre-set 404 page is not loaded:
document.getelementbyid('txtbox') is not working when I used in content page as it is working
I'm trying to change pageindex on page_Load event but its not working. I can
i have tried this code to redirect a php page.but it s not working
I'm working with page template in WordPress (don't matter). I'll try insert a picture
I'm working with wordpress locally and for some reason when I call getimagesize() from
Possible Duplicate: Symfony - Form requested url not found I'm working on a symfony
Here is my working page . I attached buttons to white bishop and you
Working on a page with multiple sections. at the very top there is a
I'm working on a page where I need to associate a list of objects

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.