Problem using role_has_cap hook

I finally figured it out: To start with, I was using the wrong hook. I should have been using user_has_cap hook instead, which is what actually has a chance of being called when using current_user_can(). But second, and most important of all, I was seeing the page while logged-in as super_admin, which didn’t trigger the … Read more

Placement of Code in Plugin for hooking `save_post`

I’m not sure if if( !current_user_can( ‘edit_post’, $post_id ) ) return; really works. Maybe the current user isn’t set up there and you’ll have to work around it by passing the user ID in a hidden field, then retrieving it using $user = get_user_by( ‘id’, esc_attr( $_POST[‘user_id’] ) ); wp_set_current_user( $user->user_id ); if ( ! … Read more

Custom Blog Post Listing in Genesis Sample Child Theme

You are going about this pretty much all wrong. You should read the instructions before continuing. An Introduction to Child Themes An Introduction to Hooks in the Genesis Framework for WordPress The second code you provided can be rewritten as this: // Template Name: Page Template genesis(); That’s it. Genesis takes care of all that … Read more

How to add rewrite rules and pagination to retrieve attachments files?

Based on the comments of @Milo and using the rewrite analyzer plugin I found what I understand as a conflict in the rewrite rules?. The following url: exams/high-school/city-name/subject/math/ matches the following rules Pattern: (.?.+?)/page/?([0-9]{1,})/?$ Subtitution: pagename: exams/high-school/city-name/subject/math paged: 1 Pattern: (.?.+?)(/[0-9]+)?/?$ Subtitution: pagename: exams/high-school/city-name/subject/math/page page: /1 Pattern: exams/([^/]+)/([^/]+)/subject/([^/]+)/?$ Subtitution: pagename: examns level: high-school city: city-name … Read more