insufficient permissions; coding an action for plugin governed by custom capability

You should not use the page parameter in an admin url unless you are going to go to an options page because a check for the ‘manage_options’ capability is the default permissions check. The goal of the ‘Delete Cache’ link is to run an action, then redirect to the current page/post; it is not to … Read more

Settings options not showing up on Sub Menu page in WordPress plugin

If you check the arguments for add_menu_page, you’ll see that the fifth argument is your callback function. And, right now, there’s nothing in the mj_admin function. What you need to do is output your form in that function. <?php function mj_admin(){ ?> <h2>My Settings Page</h2> <form action=”options.php” method=”post”> <?php settings_fields( ‘mj-admin-settings’ ); do_settings_sections(‘mj-admin-settings’); submit_button(); ?> … Read more

How to add a new taxonomy link to the admin menu

The taxonomy admin page will be handled by WordPress once you register your custom taxonomy. add_action( ‘init’, ‘create_ticker_taxonomies’, 0 ); //create two taxonomies, genres and writers for the post type “book” function create_ticker_taxonomies() { // Add new taxonomy, make it non-hierarchical (like ‘tags’) $labels = array( ‘name’ => _x( ‘Tickers’, ‘taxonomy general name’ ), … … Read more

WordPress Post HTML after Posting

add_action(‘publish_post’, ’email_post’); function email_post($postID) { $post = get_post($postID); $content = $post->post_content; $content = apply_filters(‘the_content’, $content); $content = str_replace(‘]]>’, ‘]]>’, $content); $mailto = ‘youremail’; $subject=”New Post”; if(mail($mailto, $subject, $content)) return true; else return false; } Be sure to set your headers or anything else you might need to populate your email correctly. This is untested, but … Read more