Skip to content

Instantly share code, notes, and snippets.

@coulterpeterson
Created September 19, 2023 20:57
Show Gist options
  • Save coulterpeterson/ab37eb5d158756a42003f833343b8394 to your computer and use it in GitHub Desktop.
Save coulterpeterson/ab37eb5d158756a42003f833343b8394 to your computer and use it in GitHub Desktop.
GP Populate Anything Register Custom Data Object
<?php
add_action( 'plugins_loaded', 'register_object' );
function register_object() {
if ( class_exists( 'GP_Populate_Anything' ) && class_exists( 'GPPA_Object_Type' ) ) {
// For a starter class file, you can copy one from source like
// wp-content\plugins\gp-populate-anything\includes\class-object-type-post.php
require_once plugin_dir_path( __FILE__ ) . 'includes/class-object-type-YOURTYPE.php';
gp_populate_anything()->register_object_type( 'yourtype', 'GPPA_Object_Type_YOURTYPE' );
} else {
return;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment