Changing upload dir in a plugin regardless of post type

Typo: ‘ not is ‘ You have a weired Editor. You’re simply using the wrong type of quotes: “ should be ” ‘ should be ‘ Here’s the changed function: function wpse43013_custom_upload_directory( $args ) { // If the parent_base is “members”, upload to plugin directory if ( ‘members’ === get_current_screen()->parent_base ) return wp_parse_args( $args, array_fill_keys( … Read more

Beginner advice

I would strongly recommend that you do not go for books as your main source of knowledge and learning, but instead attempt to code and develop in WordPress itself, then use the internet to research when you have a gap in your knowledge. Take apart plugins and themes that do what you want, or look … Read more

include wp-blog-header not working on MAMP

You’re making something completely wrong. Header comment In your main file, you need the following comment on top (ex. taken from Contact form 7): <?php /* Plugin Name: Contact Form 7 Plugin URI: http://contactform7.com/ Description: Just another contact form plugin. Simple but flexible. Author: Takayuki Miyoshi Author URI: http://ideasilo.wordpress.com/ Text Domain: wpcf7 Domain Path: /languages/ … Read more

Get name and email of current unregistered user, who has recently submitted name and email in comment form?

An unregistered user’s name and email are available in cookies, once s/he has left a comment. The cookies are named like: comment_author_3e6aea64ec43ed661a5dee3433f1e8bc comment_author_email_3e6aea64ec43ed661a5dee3433f1e8bc You can retrieve them like so: sanitize_comment_cookies(); wp_get_current_commenter(); // returns comment_author, // comment_author_email, comment_author_url They’re created here in comment.php: /** * Sets the cookies used to store an unauthenticated commentator’s identity. Typically … Read more

how do you prevent showing a particular category on the admin dashboard for specific user roles?

Based on the first Answer from Mike Schinkel. For testing purposes in a default installation, the category is “Uncategorized”. add_filter( ‘list_terms_exclusions’, ‘wpse_59652_list_terms_exclusions’, 10, 2 ); function wpse_59652_list_terms_exclusions( $exclusions, $args ) { global $current_screen; if( ‘post’ != $current_screen->post_type ) return $exclusions; if( !current_user_can(‘delete_others_pages’) ) return $exclusions; return $exclusions . ” AND ( t.name <> ‘Uncategorized’ )”; … Read more