I’m looking to join three tables. One of the criteria is to join the title of a page name to a table of categories.
The problem is “wp_posts.post_title” is pure data. For this example, wp_posts.post_title is “John Smith & Gary Anderson”. What I am trying to join wp_posts on is the post_title to “wp_terms.name”, and wp_terms.name contains data that has been input using htmlentities. For this example, wp_terms.name is “John Smith & Gary Anderson”.
How would it be possible to join wp_posts using wp_posts.post_title=wp_terms.name, where they are both so similar, but special characters f/html are throwing it off.
My query now is:
SELECT wp_posts.post_title, wp_posts.guid, wp_terms.name
FROM wp_terms
INNER JOIN wp_term_taxonomy ON wp_term_taxonomy.term_id = wp_terms.term_id
AND wp_term_taxonomy.parent = ‘247’
INNER JOIN wp_posts ON wp_posts.post_title=wp_terms.name AND wp_posts.post_parent = ‘92’
AND wp_posts.post_status = ‘publish’
I bolded the culprit as to what’s throwing the query off.