Query posts ordering by title, but ignore ” and special characters

Question

I use following function to get my custom posts ordering by title

$posts = get_posts(
    array(
        "orderby"=> "title",
        "order" => "ASC",
        "post_type" => "my-custom-post-type",
        "posts_per_page" => -1,
        "fields" => "ids",
        "meta_query" => array(
            array(
                "key" => "ams_park_id",
                "value" => get_the_ID(),
            )
        )
    )
);

And it orders by title, the problem is that i have one posts that have is titled: “It’s a small world”, and this is being ordered at the beginning of the list.

Example of the current returning list:

0 - "It's a small world"
1 - Albatross
2 - Alligator
3 - Baboon
4 - Camel
5 - Fox
6 - Hino
7 - Iguana
8 - Jackal
9...

How can i make to make the selector ignore the quote and send it to the “i” part of the order? Example:

0 - Albatross
1 - Alligator
2 - Baboon
3 - Camel
4 - Fox
5 - Hino
6 - Iguana
7 - "It's a small world"
8 - Jackal
9...
0
, Rodrigo Butzke 4 years 2020-03-05T11:52:44-05:00 0 Answers 98 views 0

Leave an answer

Browse
Browse