Search results not giving me the page

So my site: http://www.pinnacleoffice.ca/ ... i have a page called seating (http://www.pinnacleoffice.ca/services/seating/). When I do search for "Office Chairs" ( We're an office supply company) the seating page doesn't show up.

The word office chair is in the page text, but that isn't helping. I can't add a tag on the page, cause it's a portfolio item (a section built into the theme). What are my options?

  • Dimitris
    • Support Star

    Hey there Amanda,

    hope you're doing good and thanks for asking us!

    I just inspected your website with your search keys and I realised that search results are actually case sensitive.
    /?s=Office+Chairs returns nothing while
    /?s=office+chair returns four results including the "Seating" page.

    In order to surpass this you should alter some DB tables as detailed described in this link http://bordoni.me/make-wordpress-database-case-insensitive/
    Please keep in mind to always perform a backup before messing with your database.

    Feel free to give this a try and inform us about the results! :slight_smile:
    Kind regards,
    Dimitris

  • Amanda
    • The Incredible Code Injector

    Whoa, i'm not sure about this ....

    I have this code:
    ALTER TABLEwp_posts` CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
    ALTER TABLE wp_postmeta CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;`

    but where do I put it? It is a command line thing?

  • Adam Czajczyk
    • Support Gorilla

    Hello Amanda!

    The code that you posted (it got a bit broken in post editor but don't worry about that) is an SQL (Structured Query Language) query which is used to interact with the database. In fact the way your WordPress asks the database for data looks very similar to this :slight_smile:

    The way to apply it to the database is to login to the phpMyAdmin panel on your server, select the database that is used with your WordPress install, switch to the "SQL Query" tab" and put that query there, then use "execute" (or "run" depending on version of phpMyAdmin) button.

    You would however need to make sure as well that the names of the tables in that code include proper "WP prefix". By default it's "wp_" so table can be for example "wp_postmeta" but it's better to double-check this. While browsing the database with phpMyAdmin you will see whether all the tables names start with "wp_" prefix or with something else; you could then tweak the code above.

    Do you think you can handle this or do you need more assistance?

    Best regards,
    Adam

  • Milan
    • WordPress Wizard

    Hello Amanda ,

    Hope you are well today and won't mind me chiming here. :slight_smile:

    I am sorry but I can see that search listing on your site without any issue, Please refer this screenshot to confirm this. :slight_smile:

    Could you please check this one more time and confirm if its working ?

    Look forward to hearing back from you. :slight_smile:
    Best Regards,
    Milan

  • Adam Czajczyk
    • Support Gorilla

    Hello Amanda!

    Yeah, I'm adding a some keywords in the keywords field in Yoast ... i think it is helping.

    Thanks for letting us know what works for you. I'm still not sure why after the changes the search wasn't returning proper results for your but it's possible that it is either the theme or other plugin that's changing default search behavior. If you wish me to investigate it further, let me know please.

    On another note ... how does Yoast compare with the WPMUDEV SEO crawl plugin?

    They are certainly different. YOAST is well known but also very complex and it slowly becomes kind of an "all in one" plugin that aims to go beyond pure SEO. Our SmartCrawl is focused on core SEO aspects only so in this way it's different from it.

    I'm not in a position to review these plugins and even though personally I'm not a big fan of Yoast, I'd say that the best way to find out which ever works best for you would be to give them both some tests. You may also ask other WPMU DEV members about opinions in the "Members" section of our forum.

    Best regards,
    Adam

  • Adam Czajczyk
    • Support Gorilla

    Hello Amanda!

    YEs ... i would love for you to investigate! I'm losing the battle with it.

    I'll be more than happy to assist you with this and thanks for granting access :slight_smile:

    I checked your site and it seems that the reason is simple. The portfolio items (under the /services/ slug) are custom posts (posts of custom post type). These are not included in WP native search by default and that's why there's no search results for them. I'm sorry that I haven't told you that earlier but I wasn't aware that these are custom posts - I found out about that only after accessing your site.

    The solution would be to "tell WordPress" to include this custom post type into search results. This can be achieved with a following snippet of code:

    <?php
    add_filter( 'pre_get_posts', 'tgm_io_cpt_search' );
    /**
     * This function modifies the main WordPress query to include an array of
     * post types instead of the default 'post' post type.
     *
     * param object $query  The original query.
     * @return object $query The amended query.
     */
    function tgm_io_cpt_search( $query ) {
    
        if ( $query->is_search ) {
    	$query->set( 'post_type', array( 'post', 'page', 'tcsn_portfolio', 'tcsn_testimonial', 'tcsn_team' ) );
        }
    
        return $query;
    
    }

    (original code: https://gist.github.com/thomasgriffin/4159035#file-gistfile1-php)

    To apply it to your site:

    - create an empty file with a ".php" extension (e.g. "also-search-portfolio.php")
    - copy the code that I posted above and past it to the file
    - upload the file to the "/wp-content/mu-plugins" folder on your server

    If there's no "mu-plugins" folder inside the "wp-content" folder just create it.

    This code alters the "search filters" used by WordPress and sets them to include "posts", "pages", "tcsn_portfolio" (these are your "portfolio" posts), "tcsn_testimonial" (Testimonials) and "tcsn_team" (Team) post types.

    Give it a try please and let me know if that helped.

    Best regards,
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.