Hiding posts and pages in panel

The code you posted doesn’t work because there is no global $currentpage. There are $current_screen and $pagenow. add_action( ‘pre_get_posts’, ‘wpse_63414_hide_pages’ ); function wpse_63414_hide_pages( $query ) { if( !is_admin() ) return $query; global $pagenow; $pages = array(‘2′,’26’); if( ‘edit.php’ == $pagenow && ( get_query_var(‘post_type’) && ‘page’ == get_query_var(‘post_type’) ) ) $query->set( ‘post__not_in’, $pages ); return $query; … Read more

Looping through tabular data

The biggest problem here is syncing between two dissimilar sets of data. This looks like a good use-case for @scribu ‘s Posts2Posts plugin. Once you’ve installed that, you can create a direct correlation between the different post-types and query that connection.

Customizing WP tables or adding new ones?

You should avoid adding new tables or customising the existing tables to add fields for users. If you want to store a phone number etc, do it using user meta: add_user_meta( $user_id, ‘riccardo_phone_number’, ‘0123-456-7890’ ); …. $phone_number = get_user_meta( $user_id ); User meta is a key and a value with a post ID in the … Read more

Can’t pass table to $wpdb->prepare

The prepare() method escapes %s. The second piece of code you listed breaks because quotation marks are added to the table name, hence it doesn’t match what’s in the DB. The first piece of code works because it’s a straight string replacement hence matching the name of the table in the database. What is the … Read more

Include custom table into search results

It’s probably SQL Full Text Search what you’re looking for. Maybe this tutorial helps you forward: http://www.blrf.net/howto/49_Wordpress__How_to_implement_MySQL_full_text_search_.html There is also a WP plugin with Full Text Search capability, but it’s not updated for a while: http://urbangiraffe.com/plugins/search-unleashed/

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)