Created
November 8, 2019 05:36
-
-
Save kprajapatii/9de152dddeeb7bdb0d2f1cbc8711080c to your computer and use it in GitHub Desktop.
[GeoDirectory] Fix database error "WordPress database error Column 'post_category' in field list is ambiguous for query"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* CSV Export: Fix database error "WordPress database error Column 'post_category' in field list is ambiguous for query". | |
*/ | |
function gd_snippet_20190827_imex_export_posts_query( $query, $post_type ) { | |
$table = geodir_db_cpt_table( $post_type ); | |
$query = str_replace( ",post_category", ",{$table}.post_category", $query ); | |
$query = str_replace( ",`post_category`", ",`{$table}`.`post_category`", $query ); | |
return $query; | |
} | |
add_filter( 'geodir_imex_export_posts_query', 'gd_snippet_20190827_imex_export_posts_query', 20, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment