Inventory_Presser_Plugin::register_meta_fields()
Registers all meta fields our custom post type uses to define a vehicle and its attachments.
Return Return
(void)
Source Source
File: inventory-presser.php
/** * Action hook callback. Prevents vehicles from lingering in the Trash after * they've been deleted if a plugin setting dictates such behavior. * * @param int $post_id * @return void */ public function maybe_force_delete( $post_id ) { // is the post a vehicle? if ( INVP::POST_TYPE !== get_post_type( $post_id ) ) { return; } $settings = INVP::settings(); if ( ! $settings['skip_trash'] ) { return; } // force delete. wp_delete_post( $post_id, true ); } /** * Registers all meta fields our custom post type uses to define a vehicle * and its attachments. * * @return void */ public function register_meta_fields() { // Add meta fields to our post type. foreach ( INVP::keys_and_types( true ) as $key_arr ) { if ( empty( $key_arr['name'] ) ) { continue; } $key = apply_filters( 'invp_prefix_meta_key', $key_arr['name'] ); register_post_meta( INVP::POST_TYPE, $key, array( 'show_in_rest' => true, 'single' => 'options_array' !== $key_arr['name'], 'type' => $key_arr['type'] ?? 'string', ) ); } // Add a couple fields that are used on media attachments. $attachment_keys = array();
Expand full source codeCollapse full source codeView on Github