Delete Post From Front-End and attachment permanently

Try: <?php if (current_user_can(‘edit_post’, $post->ID)) echo “<a href=”” . wp_nonce_url(“/wp-admin/post.php?action=delete&amp;post=$id”, “delete-post_’ . $post->ID) . “‘>Delete post</a>” ?> You can decide when to empty the WordPress trash by adding this code to the wp-config.php file in your WordPress root directory. define(‘EMPTY_TRASH_DAYS’, 1 ); The 1 in the code signifies you want to empty the trash everyday. … Read more

Custom php page in WordPress theme?

Move the template files out of the subdirectory, and put them in the Theme’s root directory. Then, if you simply want to include the contents of those template files in other template files, simply call get_template_part( ‘test-page-name.php’ );. If you insist on keeping these files in a subdirectory, you’ll need to include them via locate_template().

Can I pass two roles to the function get_users?

I don’t think it’s possible to do it with the get_users function. From what the Codex implies, you cannot pass arrays to the role argument. But it should be fairly easy to code your way out of that limitation. Try this: function filter_two_roles($user) { $roles = array(‘academic’,’student’); return in_array($user->roles[0], $roles); } $users = get_users(‘fields=all_with_meta’); // … Read more