Tag Info

Hot answers tagged

2

register_activation_hook is one-time only activation hook. It can be used for database structure creation, as example, that needs to fire only on plugin activation trigger. In order to set a custom taxonomy you need a hook that will fire not just once, but per every WordPress load. Such as init. Use add_action( 'init', 'YOUR_CALLBACK' ); to achieve that


1

The earliest safe hook to get post information is the template_redirect hook. All the hooks in question runs before Wordpress has setup postdata, so any post info are still unavailable at that point. The globals like $wp_query and $post will still contain no data, that is why your efforts returns nothing. EDIT Extra info as per comment by @TheDeadMedic ...


1

Textdomain Error The error message mean, that you haven't a textdomain. There is required for translation of this string. In the first error message is the problem the missing textdomain on the function _n_noop(). Right usage as example below. _n_noop( 'Security Release', 'Security Releases', 'your_textdomain' ); Text Domain Information about the ...


1

Use php dot notation. Try: $my_templates = get_stylesheet_directory() . '/lp/'; $base = array( trailingslashit(get_template_directory()), $my_templates );


1

If you dont want 'TopLevel' menu to represent a custom page you can use: add_menu_page( 'TopLevel', 'TopLevel', 'MENU_CAP_LVL', 'MENU_SLUG', 'MENU_CB' ); add_submenu_page( 'MENU_SLUG', 'SubMenu', 'SubMenu', 'MENU_CAP_LVL', 'SUB_MENU_SLUG', 'SUB_MENU_CB' ); add_submenu_page( 'MENU_SLUG', 'SubMenu-A', 'SubMenu-A', 'MENU_CAP_LVL', 'SUB_MENU_A_SLUG', ...


1

Plugins that load the WordPress environment this way get rejected from the repository, as they are prone to failure in non-standard configurations. For something like this I would use the admin-post-$action to receive requests. The WordPress API will be available where you can check if users are authorized to perform specific actions.



Only top voted, non community-wiki answers of a minimum length are eligible