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 4114476
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:27:37+00:00 2026-05-20T22:27:37+00:00

I have code that takes the name of a term and pulls in a

  • 0

I have code that takes the name of a term and pulls in a post of a custom post type of the same name. This works well. Except when a £ character is in the title.

e.g. pseudocode

$q = new WP_Query (array( 'name' => "Insurance Rating £1K"));
if($q->have_posts()){
    // expected path of logic flow
} else {
    // nothing was found =s
}

This post does indeed exist, yet it is not found, and this problem only affects cases with a ‘£’ character in the title. Since WordPress already sanitizes the titles etc, what is happening? Why does this not work?

edit:

This is a general case, not specific to any codebase of mine. I want to know why this happens and how to avoid it, the codebase this first arose in is irrelevant. So I dont need an alternative solution, as I’m looking for Why it happened

edit 2:

The database tables are using utf8_general_ci encoding.

The £ character is also being saved as is, not as a html entity, here’s a screenshot from phpmyadmin:

Database row

  • 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-20T22:27:38+00:00Added an answer on May 20, 2026 at 10:27 pm

    What encoding is your PHP file in, and does it match the encoding of the database? They need to match for this to work. (Check your IDE or this link provided by @Tom)

    Failing that, make sure that the character isn’t a £ entity instead of the literal character.

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

Sidebar

Related Questions

I have this small piece of code that basically takes a list and runs
I have this piece of code that takes my xml and puts it into
I would like to have a custom snippet of html form code that takes
I have this code that takes info from a form and sends it to
I have the following code. A switch statement that takes in a state name
I have the following code that takes a double value and converts it to
I have a piece of code that takes several rows from a database and
I have the following piece of code that takes in some words, stores them
I have a code at the moment that takes a line from a .txt
I have the following piece of code from a function that takes the host

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.