Why does rewrite rule work for page not for custom post type post?

Well, I found the solution. It seems that, when applying a rewrite rule on a custom post type post, one needs to tell WP the custom post type’s name within the rewrite rule itself. Here’s the code that does NOT work (redirects and drops parameter variables instead of rewrite): function add_rewrite_rules($rules) { $newrules = array(‘cpt-slug/([^/]+)/([^/]+)/?$’ … Read more

blog page showing only first post

It appears that blog.php is a custom static page template, yes? If so, then the primary loop will display the post content of the static page to which it is applied. If you want to create a custom page template that displays blog posts, you will need to create a secondary loop to query/output the … Read more

Rewriting WordPress core functionallity: Changing the private posts

First of all I have to say that private posts already fit your needs, because logged in users with proper capability will see the posts in home page, archives, searches and so on. Proper capability is ‘read_private_posts’. This cap is assigned by default to administrators and editors. So, your “member” users should have one of … Read more

Custom Taxonomies Incorrectly Counting Revisions?

Hi @berkleebassist: It’s hard to verify your issue without admin access to your site and your database but I can give you some direction that might help. There are two functions in /wp-includes/taxonomy.php that update taxonomy term count: wp_update_term_count_now() and _update_post_term_count(). They are located (in WordPress v3.0.1) at line 2454 and line 2049, respectively. Both … Read more

Specify number of posts in my ‘tax_query’

Never user query_posts, under any circumstances. Use WP_Query instead, which is how query_posts works internally, but without the trickery and downsides. You’ll also find that the WP_Query documentation gives you explanations for every parameter, including what you are trying to do: posts_per_page (int) – number of post to show per page (available with Version 2.1, … Read more

How do I create Comma Separated list of attached image ids?

You can try this one-liner, within the loop, instead of all your above code: $ids = join( ‘,’, wp_list_pluck( get_attached_media(‘image’ ), ‘ID’ ) ); where we pluck out the ID’s from the get_attached_media() output. Another approach would be to use: $ids = join( ‘,’, get_attached_media( ‘_image_ids’ ) ); where we’ve introduced a new input parameter … Read more

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