How to get the default post per page value in WordPress?

Can anyone tell me how can I retrieve the default value of Post per page? The value I set in


Let me explain, I am writing a custom query using wp_query() where I can set posts_per_page, I want to set the value based on the default WordPress setting.

Any settings you save are stored in the wp_options table. And you can get them with get_option() function. You can get the default post per page from the setting with the below code.

$posts_per_page = get_option( 'posts_per_page' );

For more details, you can check the reference below