Skip to content

Instantly share code, notes, and snippets.

@richaber
Last active August 29, 2015 14:26
Show Gist options
  • Save richaber/36a72d2362e56f59db58 to your computer and use it in GitHub Desktop.
Save richaber/36a72d2362e56f59db58 to your computer and use it in GitHub Desktop.
Ad Code Manager Admin Screen Pagination and Per Page Filters
<?php
/**
* Increase the number of ACM posts that can be displayed in the ACM admin screen.
*
* For some unknown reason, ACM limits the display of ad codes on it's own management screens to 50 ads total out of the box.
* More than 50 ad codes may actually exist in the database, but the ACM screen will only show 2 pages, 25 each, for a total of 50,
* even if you have hundreds of ads codes stored in the database! Because of this you can never edit the ads that are on pages 3+!
* Increase the number of posts that ACM will retrieve for the admin screen with acm_ad_code_count filter.
* Increase the number of ads per paginated page with the acm_list_table_per_page filter.
* It appears some sort of caching may be involved, leading to this unexpected/unwanted behavior.
*/
/** increase the number of posts that ACM will show in ACM admin screen, why default limits to 50? */
add_filter( 'acm_ad_code_count', function( $numberposts ) { return -1; }, 99 );
/** increase the number of posts that ACM will show per page in ACM admin screen, defaults to 25 */
add_filter( 'acm_list_table_per_page', function( $perpage ) { return -1; }, 99 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment