Skip to content

Instantly share code, notes, and snippets.

@rfmeier
Created January 8, 2016 21:47
Show Gist options
  • Select an option

  • Save rfmeier/01e6e8f72483afbe2b4f to your computer and use it in GitHub Desktop.

Select an option

Save rfmeier/01e6e8f72483afbe2b4f to your computer and use it in GitHub Desktop.
Register a sanitization callback for the custom setting
<?php
/**
* Register a sanitization callback for the custom setting.
*/
add_action( 'genesis_settings_sanitizer_init', 'cpt_as_genesis_sanitize_settings' );
/**
* Callback for Genesis 'genesis_settings_sanitizer_init' action.
*
* Add the settings to the filter.
*
* @global $_genesis_admin_cpt_archives_testimony Genesis_Admin_CPT_Archive_Settings object for the 'testimony' post type.
*
* @uses genesis_add_option_filter
*
* @since 0.0.1
*
* @return void
*/
function cpt_as_genesis_sanitize_settings() {
global $_genesis_admin_cpt_archives_testimony;
genesis_add_option_filter(
'absint',
$_genesis_admin_cpt_archives_testimony->settings_field,
array(
'posts_per_page',
)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment