Changes Won’t Save with JOINs
-
The plugin will not update values after I have joined one table with another in the select clause. I am trying to enable a client to mass-edit values of a custom taxonomy (specifically, the taxonomy created by the Stock Locations for WooCommerce plugin.)
Here is the code I am working with, which properly displays the table but does nothing when I press “save changes.”
if(function_exists('add_db_table_editor')){ add_db_table_editor(array( 'title'=>'Batch Edit Products', 'table'=>'wp_postmeta', 'id_column'=>"meta_id", 'hide_columns'=>'meta_id', 'noedit_columns'=>(array('Product','Location')), 'sql'=>' SELECT meta_id, post_title AS <code>Product</code>, name AS <code>Location</code>, meta_value AS <code>Stock</code> from wp_term_taxonomy JOIN wp_terms ON wp_terms.term_id=wp_term_taxonomy.term_taxonomy_id JOIN wp_postmeta ON wp_postmeta.meta_key = CONCAT("_stock_at_", wp_terms.term_id) JOIN wp_posts ON wp_posts.ID = wp_postmeta.post_id WHERE taxonomy="location" ' )); }
When I just SELECT the wp_postmeta table and try to make an edit, it works fine.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Changes Won’t Save with JOINs’ is closed to new replies.