Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

create plugin wordpress

1
2
3
4
5
6
sept
8
9
dix
11
12
13
14
15
16
17
18
19
/**
 * Register the "book" custom post type
 */
function pluginprefix_setup_post_type() {
    register_post_type( 'book', ['public' => true ] ); 
} 
add_action( 'init', 'pluginprefix_setup_post_type' );
 
 
/**
 * Activate the plugin.
 */
function pluginprefix_activate() { 
    // Trigger our function that registers the custom post type plugin.
    pluginprefix_setup_post_type(); 
    // Clear the permalinks after the post type has been registered.
    flush_rewrite_rules(); 
}
register_activation_hook( __FILE__, 'pluginprefix_activate' );
Source by developer.wordpress.org #
 
PREVIOUS NEXT
Tagged: #create #plugin #wordpress
ADD COMMENT
Topic
Name
8+5 =