Getting started with WordPressget_bloginfo()Enqueuing scriptsMaking network requests with HTTP APIEnqueuing Styleshome_url()Custom Post Typestemplate_includeThe Loop (main WordPress loop)AJAXThe $wpdb ObjectActions and Filterswp_get_current_user()Add/remove contact info for users with user_contactmethods filter hookCreating a custom templateCustomizer Hello WorldCustomizer Basics (Add Panel, Section, Setting, Control)The Admin Bar (aka "The Toolbar")Querying postsAlternating main loop (pre_get_posts filter)ShortcodeCreate a Post Programmaticallyget_template_part()Taxonomiesget_template_part()ShortcodesPost FormatsCustom exerpts with excerpt_length and excerpt_morePlugin developmentSecurity in WordPress - EscapingTemplate hierarchyRemove Version from Wordpress and StylesheetsChild Theme Basicsadd_action()get_template_part()Shortcode with attributeSidebarsSecurity in WordPress - SanitizationinitCreate Template for Custom Post TypeFunction: add_action()Add ShortcodeHow Can I integrate Markdown editor with Advance Custom Field's repeater Add-on.Installation and Configurationwp_get_current_user()WP-CronSecure your installationOptions APIFunction : wp_trim_words()WP_Query() LoopUpdate WordPress ManuallyThemesWP-CLIDebuggingadd_menu_page()add_submenu_page()get_option()get_permalink()get_the_category()the_title()get_the_title()add_editor_style()add_theme_support()WordPress Plugin creationRun WordPress local with XAMPPAdmin Dashboard WidgetsSite MigrationMeta BoxRemove Auto Line Breaks From Content and Excerptget_home_path()Wordpress theme and child-theme developmentREST API

init

Other topics

Remarks:

init is an action hook that gets fired after WordPress has finished loading but before any HTTP headers are sent.

Processing $_POST request data

add_action('init', 'process_post_data');

function process_post_data() {
    if( isset( $_POST ) ) {
        // process $_POST data here
    }
}

Processing $_GET request data

add_action('init', 'process_get_data');

function process_get_data() {
    if( isset( $_GET ) ) {
        // process $_GET data here
    }
}

Registering a custom post type

add_action( 'init', function() {
    register_post_type( 'event', array(
            'public' => true,
            'label'  => 'Events'
        );
    );
});

Registers a new custom post type with a label Events and a slug event

Syntax:

  1. add_action( 'init', callable $function )

Contributors

Topic Id: 6375

Example Ids: 21956,21957,21958

This site is not affiliated with any of the contributors.