quotes problem in very simple sql
if you’re communicating with the WordPress database itself, try using $wpdb->prepare() on your select string before running it as $wpdb->query() – it should format it for you. Further reading: Codex
if you’re communicating with the WordPress database itself, try using $wpdb->prepare() on your select string before running it as $wpdb->query() – it should format it for you. Further reading: Codex
You can do that by running this SQL query: UPDATE `wp_posts` SET `post_password` = ” WHERE `post_type` = ‘post’; Change wp_posts to match your own posts table name.
You need to add the global $wpdb reference and also add the second parameter required for prepare(): global $wpdb; $post_id = $post->ID; $reviewScore = $wpdb->query( $wpdb->prepare( “SELECT review FROM {$wpdb->prefix}gdsr_data_article WHERE post_id = %d”, $post_id ) );
You call your header.php file by calling get_header() function in single.php file. It means that your $postid_profile variable exists only in scope of get_header() function. To make it visible in global scope you need to make your variable global. So your code should be modified like this: ### get the author info global $current_user, $postid_profile; … Read more
The error was here: (Thank you @Rarst) if ($column_name == ‘custom_checkbox_group_sesso’) { $sesso_occupanti = get_post_meta($post_ID, “custom_checkbox_group_sesso”, true); //check that we have a custom field if ($sesso_occupanti != “”) { // Separate our comma separated list into an array $sesso_occupanti = explode(“,”, $sesso_occupanti); //loop through our new array foreach ($sesso_occupanti as $sesso) { echo $sesso ; … Read more
Off the top of my head… I can think of a plugin that does this: http://buddypress.org/community/groups/bp-profile-search/ Perhaps this will provide you with a good starting point for what you’re trying to get done.
You are giving your own solution here. Use the onchange event for the dropdowns, or the .change event in the jquery API. Otherwise, this is called ‘cascading’ – dropdowns. Also, I don’t think this has anything to do with wordpress. Similar to this question
You don’t have to export and then re-import, you can do it all via the API in one go, no XML required. here’s a quick example plugin: <?php /* Plugin Name: WPA_convert_types */ function wpa_convert_types_page() { add_management_page( ‘WPA convert types’, ‘WPA convert types’, ‘manage_options’, ‘wpa_convert_types’, ‘wpa_convert_types_render_page’ ); } add_action(‘admin_menu’, ‘wpa_convert_types_page’); function wpa_convert_types_render_page() { if( isset( … Read more
The wordpress database seems fairly straight forward and is extremely well documented: http://codex.wordpress.org/Database_Description It seems to me that all the category information is stored in the table wp_term_relationships. So you should select from the comments table, join it with the posts table and then the term_relationships table in order to get the category for each … Read more
If you are going to do this is SQL, use a subquery. SELECT *, (SELECT meta_value FROM wp_commentmeta WHERE meta_key = ‘your-meta-key’ AND wp_commentmeta.comment_id = wp_comments.comment_ID LIMIT 1) as comment_author FROM wp_comments Instead of the *, enumerate the fields you want but leave out comment_author. Obviously, $wpdb functions to keep the table names straight.