How can I prevent users from creating new categories?

You should to remove a capability named ‘manage_categories’ from user role or roles, for example: /** * Don’t let subscribers add/edit/remove categories. * * You should call the function once when your plugin or theme is activated. * * @uses WP_Role::remove_cap() */ function remove_subscribers_manage_categories() { // get_role returns an instance of WP_Role. $role = get_role( … Read more

adding custom fields to next and previous post link

Here’s the code for what you’re trying to do (accessing post custom value): <?php global $post; $prev_post = get_adjacent_post(); $next_post = get_adjacent_post( false, ”, false ); $prev_post_id = $prev_post->ID; $next_post_id = $next_post->ID; // this should, according to your code above, be the http://example.com/your/img.jpg string $prev_img_path = get_post_custom_values( ‘your_key_name’, $prev_post_id ); $next_img_path = get_post_custom_values( ‘your_key_name’, $next_post_id … Read more

Automated adding of one tag to all the posts in a category

A good starting point is (as always) the Codex function reference. There’s one nice little function that can be used to add tags or categories (or whatever built-in or custom taxonomy) to a post: wp_set_object_terms();. Maybe wp_set_post_terms(); is more easy to use. Further explanation can be found when you follow the link. There are multiple … Read more

Assigning a category to a user role

This may be similar to what you are looking for, it doesn’t force a category, but doesn’t let the user submit the new post unless at least one category is selected This solution requires jQuery, but with little modification can be ported to plain JavaScript //intercept the “update” or “publish” button $(“#post”).submit(function(e){ //grab the GET … Read more

Show Post from parent category (custom taxonomy) ONLY!

Any tax_query can take an include_children argument (see Codex) that defaults to true. So just add that to your code and it should work: <?php $args = array( ‘posts_per_page’ => 100, ‘post_status’ => ‘publish’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘ait-dir-item-category’, ‘field’ => ‘id’, ‘terms’ => 75, ‘include_children’ => false ) ), ‘post_type’ => ‘ait-dir-item’ … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)