Admin notices

This documentation for the Custom post types plugin for WordPress allows you to customize all features.

To get professional support you need to make a donation to get the PRO version of the plugin.

You can add as many admin notices as you like, as for the native WordPress notices, will be present in the administrative dashboard.

New admin notice using UI

Registering and adding a new admin notice to your WordPress website has never been easier directly from the administration area.

  1. From the “Extend / Manage” menu click on the “Admin notices” item;
  2. From the “Admin notice” page at the top click on the “Add admin notice” button;
  3. Configure the new admin notice and click on the “Publish” button;
  4. See the new “Admin notice” on the dashboard;

cpt_admin_notices_register

apply_filters( 'cpt_admin_notices_register', $registered_notices )

Filter the registered admin notices data.

Parameters
  • $registered_noticesarray

    Array of registered admin notices.

Example:

add_filter('cpt_admin_notices_register', function($registered_notices){
    $buttons = [
        [
            'link' => 'https://totalpress.org',
            'label' => 'Go to TotalPress.org',
            'target' => '_blank', // open on new window
            'cta' => true // true as button
        ],
        [
            'link' => 'https://wordpress.org',
            'label' => 'WordPress.org website'
        ]
    ];

    $registered_notices[] = [
        'id' => 'custom-notice',
        'title' => 'This is a custom notice',
        'message' => 'Lorem ipsum dolor.<br>Sit amet consectetur adipiscing elite.',
        'type' => 'success', // error - warning - success - info
        'dismissible' => 1, // days to show again - true never show again - false
        'admin_only' => false,
        'buttons' => $buttons,
    ];
    
    return $registered_notices;
});
This code is an example, add it to theme’s functions.php file or to custom plugin.
*** *******