Created
October 21, 2021 09:31
-
-
Save grantalltodavid/f590f057a76d9f19b4dc8d6c141e536f to your computer and use it in GitHub Desktop.
Sliced Invoices: pre-fill description field for new quotes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'sliced_after_description', 'si20211021_pre_fill_quote_description' ); | |
function si20211021_pre_fill_quote_description( $cmb ) { | |
global $pagenow; | |
// only pre-fills new quotes | |
if ( $pagenow === 'post-new.php' && isset( $_GET['post_type'] ) && $_GET['post_type'] === 'sliced_quote' ) { | |
$field = $cmb->get_field( '_sliced_description' ); | |
if ( $field ) { | |
$field->args['default'] = 'Text to pre-fill goes here'; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment