if not admin redirects to front page
try this function in the top of the file
if(!current_user_can('administrator')){
echo '<a href="'.home_url().'" id="notAdmin"></a>';
echo '<script>document.getElementById("notAdmin").click();</script>';
}
Related Posts:
- Remove “Category:”, “Tag:”, “Author:” from the_archive_title
- Get the ID of the page a menu item links to?
- Add container to nav_menu sub menu
- Link to user’s profile settings page?
- One Child Functions.php for Multiple Child Themes
- Disabling pingback and trackback notifications
- AJAX handler throws 400 (Bad request) – why?
- Paged Single Post doesn’t redirect to the main url after Removing Pagination
- How to get comments with mixed status using get_comments?
- How to display the_post_thumbnail if a post has one or otherwise display the first image in a post?
- Return only top-level navigation items from a menu using wp_get_nav_menu_items
- How to add .htaccess code through a function?
- Conditional tag is_page with a custom post type
- How can I rename the WordPress AJAX URL? [duplicate]
- How to add a rel attribute to images that contains their categories?
- Is it possible to be more page/post specific with admin_enqueue_script?
- radio button is checked but display not check
- Theme options WP Editor
- Enqueue styles after a plugin
- Properly applying nonce to a form using AJAX
- What is the $context in remove_meta_box function?
- Add external js file to footer with id
- Conditions for Users and Visitors
- add_filter priority problem
- wp_enqueue JavaScript in child-theme (ReferenceError) using Search & Go
- How can I enable uploading excel files?
- Enqueue scripts not working with if is page conditional tag in functions.php
- Why does the ‘wp_nav_menu’ function work only until a menu is created?
- Twentyten Child Theme: header images display messed up in admin panel
- Get Current Post ID in functions php, meta query filter
- Jquery implementation not working on page reload
- Parse error after modifying the template menu [closed]
- Reuse variable in hook callback
- Move Custom Fields on General Settings Page to New Location
- Remove adjacent_posts_rel_link under 3.2?
- Pass parameter to hooked function using custom page template
- Is my code correct to enqueue CSS on a specific page?
- Where to put random functions?
- Define PHP variable from a seperate API if statement
- WordPress function only executes once
- Dequeue Script Using Functions.php
- Auto-Tweet if Type is ‘Status’ using OAuth
- Output a specific link in WordPress post if the single post’s category’s name contain certain word
- Using $WPDB to create simple array to check against user entered value
- How to add custom li item to wordpress menu
- error at login page in wordpress
- Passing user enetered value in widget: number of words, for example
- More tag locked in Hemingway
- How to store a number (coming from cookie) into query vars for later usage in other filters?
- Suggest Users basing on User taxonomy
- Code to insert code into single php
- How to display 2 function calls in same line?
- Remove a Plugin function through theme’s function.php?
- Custom Image Size in Insert Media
- Custom function for search form
- If is_single in functions.php
- How to conditionally add a widget via a hook in functions.php
- Custom Menu in Admin doesn’t change menu in browser
- How can I show different content for different user-levels?
- WordPress function bloginfo not echoing output on parts of the pages
- get_image_tag() html output : empty src attribute
- How to change a meta value (of a published post) after X days.?
- How to change text color depending on the number value (Using javascript)
- Why should I use get_template_directory() when include files?
- How to display an image before title text in menu items
- How to add custom metakey to shop_order page’s searching function?
- How to display my comment count in the wordpress admin bar?
- reWrite wp-content url to point on my cdn
- custom error message for empty username and password using authenticate filter not working
- Modifying a WordPress Plugin
- Last updated posts shortcode in functions.php
- How to reference different css (bootstrap) stylesheets for the header and body of a page?
- I have an fatal error on my funcyions.php
- Get post_author email for Zapier Integration
- Author social media aren’t shown on the page
- get_locale() is different from $locale
- If click on Save/Publish change Post Status to Pending Review instead Publish
- Remove the delete link from pages without a plugin
- Custom download page
- HowTo: Add wrapper to columns shortcode?
- How to include a hyperlink in the body text of a custom password protected form?
- Get title from IDs in a string
- uninstall a theme programmaticlly
- Could you please correct the code is_admin()
- Update add_image_size
- What add_action reference should I be using or should I use do_action?
- Function to get the name in database table from the comma separated string
- Allow the access over wp-login.php
- Limit length of headline in Editor
- Way of getting queried loop before the query with a filter hook?
- Check if there is an post to be published in future
- Unhook the comment form in Buddypress
- Why my wp_enqueue_script doesnt work on some page?
- Need to use an external variable inside a function
- Trying to get this function to show below the content
- is_preview() always return false
- How to resize image from import image url?
- Vimeo video play button color function
- Change TinyMCE undeline outpout
- Loading newest dependency javascript module file in functions.php