mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-04-22 11:03:43 +03:00
parent
1cabbc9729
commit
c244c7e596
|
@ -57,6 +57,7 @@ function enqueue_assets() {
|
||||||
function render_company_report_page() {
|
function render_company_report_page() {
|
||||||
|
|
||||||
$status = sanitize_title( $_GET['status'] );
|
$status = sanitize_title( $_GET['status'] );
|
||||||
|
$pledge_limit = 500;
|
||||||
|
|
||||||
if ( ! in_array( $status, array( 'draft', '5ftf-deactivated', 'publish' ) ) ) {
|
if ( ! in_array( $status, array( 'draft', '5ftf-deactivated', 'publish' ) ) ) {
|
||||||
$status = 'all';
|
$status = 'all';
|
||||||
|
@ -65,13 +66,13 @@ function render_company_report_page() {
|
||||||
$pledges = get_posts( array(
|
$pledges = get_posts( array(
|
||||||
'post_type' => '5ftf_pledge',
|
'post_type' => '5ftf_pledge',
|
||||||
'post_status' => $status,
|
'post_status' => $status,
|
||||||
'posts_per_page' => 250, // set to 250 to avoid unexpected memory overuse.
|
'posts_per_page' => $pledge_limit, // set to avoid unexpected memory overuse.
|
||||||
'orderby' => 'post_title',
|
'orderby' => 'post_title',
|
||||||
'order' => 'ASC',
|
'order' => 'ASC',
|
||||||
) );
|
) );
|
||||||
|
|
||||||
// Add visible warning on page if we hit the upper limit of the query.
|
// Add visible warning on page if we hit the upper limit of the query.
|
||||||
if ( 250 == count( $pledges ) ) {
|
if ( count( $pledges ) === $pledge_limit ) {
|
||||||
echo '<p>WARNING: pledge limit reached, check the code query.</p>';
|
echo '<p>WARNING: pledge limit reached, check the code query.</p>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in a new issue