Skip to content

Instantly share code, notes, and snippets.

@plugin-republic
Created December 8, 2025 13:43
Show Gist options
  • Select an option

  • Save plugin-republic/0f2875fc722f9d5ce33fc7f5cad3493c to your computer and use it in GitHub Desktop.

Select an option

Save plugin-republic/0f2875fc722f9d5ce33fc7f5cad3493c to your computer and use it in GitHub Desktop.
<?php
/**
* Filter the available fonts for each text preview field
* List fonts in arrays using 'abel' => 'Abel' key / value pairs
* Update the field IDs to match your own
*/
function demo_filter_all_fonts( $all_fonts, $available_fonts, $field ) {
// Update the field IDs below to match your field IDs
if( $field['field_id'] == 1209 ) {
// Make an array of fonts for this field only
$available_fonts = array(
'abel' => 'Abel',
'arial' => 'Arial'
);
} else if( $field['field_id'] == 1307 ) {
// Make an array of fonts for this field only
$available_fonts = array(
'abel' => 'Abel',
'courier' => 'Courier'
);
}
$all_fonts = array_merge( array( 'default' => __( 'Default theme font', 'pr-advanced-previews-addons-ultimate' ) ), $available_fonts );
return $all_fonts;
}
add_filter( 'apaou_all_fonts', 'demo_filter_all_fonts', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment