更改代码以获取所有帖子并显示在下拉列表中,正确的知识仅获得 5 个帖子

Alter code to get all posts and show in dropdown list, right kown gets only 5 posts

我对 php 知之甚少,我已经尝试过解决这个问题,但一无所获。

我需要这个下拉列表显示所有帖子,现在它只显示 5 个帖子。

谢谢

编辑:这是唯一的其他代码

ob_start();
class externalUrlToPostThumbnail
{
function externalUrlToPostThumbnail(){            
    try{
        add_action('admin_menu', array(&$this,'ext_add_pages'));
    }
    catch(Exception $e){
        echo "Caught Exception".$e->getMessage();
    }
}
// action function for above hook
function ext_add_pages(){
    add_menu_page(__('Post Featured','mymenu'), __('Featured Image','mymenu'), 'manage_options',  'external-url-post-thumbnail', array ( & $this,'uploadImage'));
}

function uploadImage(){
    include_once('external-url-to-post-thumbnail.php');
}

function get_all_post()
{

    $options_pages = array();
    $options_pages_obj = get_posts('post_type=post');
    $options_pages[''] = 'Select a Post:';  
    foreach ($options_pages_obj as $page) {
    $options_pages[$page->ID] = $page->post_title;  
    }
    return $options_pages;
}   
}
$newObj = new externalUrlToPostThumbnail();
?>

尝试用以下函数替换函数 get_all_post()。

function get_all_post(){

    $options_pages = array();
    $args= array(
        'posts_per_page'   => -1,
        'post_type'        => 'post',
    );
    $options_pages_obj = get_posts($args);
    $options_pages[''] = 'Select a Post:';  
    foreach ($options_pages_obj as $page) {
    $options_pages[$page->ID] = $page->post_title;  
    }
    return $options_pages;
}