New answers tagged

1

You could use wp_parse_id_list() to sanitize your comma seperated list of post IDs. It's defined as: function wp_parse_id_list( $list ) { if ( !is_array($list) ) $list = preg_split('/[\s,]+/', $list); return array_unique(array_map('absint', $list)); } where we can see that it returns unique array values as well. Note that absint() is ...


0

get_posts doesn't have a post__in "variable", that's in wp_query, in get_posts (or get_pages) you would need to use include e.g. $news = get_posts( array( 'post_type' => 'post', 'include' => $newspostids, ) ); https://codex.wordpress.org/Function_Reference/get_posts


2

This is actually not that hard, but you will have to excuse me for keeping it high level because this is just a stupid thing to do as all things which are security by obscurity. All you need to do is write your WPDB driver, which inherits the WPDB class. Place it in /wp-content/db.php file and make sure to initialize the global $wpdb object with your class. ...


0

WordPress uses a single table prefix for all tables and I always set a different prefix for each site I build to improve security. You could tell your client that security is even better if you do this for all tables.



Top 50 recent answers are included