XML-RPC does not display password protected posts
-
I Worte a simple plugin to list posts from a certain category but it omits password protected posts. I added a filter to display all posts regardless of the password, but it doesn’t work.
<?php function xml_add_method( $methods ) { $methods['zio.categoryVideos'] = 'get_category_videos'; return $methods; } function allPosts($where) { $where .= " AND post_password like '%' "; return $where; } function get_category_videos( $args ) { global $post; $args = array('numberposts' => 50,'cat' => $args ); add_filter('posts_where', 'allPosts'); $myposts = query_posts( $args ); $struct = array( ); foreach( $myposts as $post ) : setup_postdata($post); $id = get_the_id(); $guid = get_permalink(); $title = get_the_title(); $struct[] = array( 'id' => $id, 'guid' => $guid, 'title' => $title, 'thumbnail' => $thumb ); endforeach; return $struct; } add_filter( 'xmlrpc_methods', 'xml_add_method' ); ?>
- The topic ‘XML-RPC does not display password protected posts’ is closed to new replies.