How can i retrieve default post per page value? from settings->reading. And total number of posts?

I want to retrieve the default value of Post per page (the value that is set in settings->reading.

I’ve looked around and so far I’ve only found ways to query it. problem is i dont want to change what was set i just want to retrieve it for pagination purposes. i thought of using $something->post_count.(i might be wrong but as i understand it returns the amount of posts displayed currently) but this could be wrong in some cases.

Read More

Also how can i get the total number of posts ?

Related posts

Leave a Reply

1 comment

  1. It’s saved in an option:

    $default_posts_per_page = get_option( 'posts_per_page' );
    

    Reference: get_option Parameters

    You can see the keys and values of all available options by manually entering the admin url:

    /wp-admin/options.php

    Edit

    Total number of posts:

    global $wp_query;
    $total_posts = $wp_query->post_count;