The error is telling that when you say:
if($admin == '1'){
PHP has no idea what you are talking about. There is no $admin so it cannot ever equal 1.
As Rick Hellewell mentioned in the comments, you might actually want is_admin() which is a function that returns a boolean (true or false).
It is quite likely the code you actually want would be like this:
// If ur an admin, you have access to the following page
if( is_user_admin() ){
// When going ...[snip]...
Edit: I originally suggested is_admin()
which I was reminded checks the page is loaded in the admin area. I should have said is_user_admin()
Related Posts:
- How can I use WordPress functions in my stylesheet?
- Customizing subject in comment notification e-mails
- Plugin or mod for wordpress to make content publication SUPER easy
- WP showing “warning: call_user_func_array()”, What to do?
- How can I pass a variable to wp_ajax action?
- How can i change an image’s author?
- Creating search filter through plugin
- WP-Members redirect if member ALREADY logged in
- How to edit/delete single row items in a table on my own menu page
- Get a list of galleries from an album in NextGEN Gallery [closed]
- Undefined property: WP_Post_Type::$ID
- Plugin exceeds memory limit
- Pass a php string to a javascript variable
- Show price with Geo IP location
- How to trigger $_GET request within admin plugin page?
- Wp favorite posts get user favorites in profile using buddypress [closed]
- How to generate video out of images via WordPress plugin
- Preferred way of cacheing a value in php
- How to remove html code in excel downloads using phpspreadsheet with wordpress plugins shortcode
- Automatically add attributes to woocommerce product?
- Edit Yoast SEO breadcrumbs output [closed]
- Adding a slider captcha to the comment system
- How to put JQuery/Ajax inside shortcode?
- Query all customers/users and check for duplicate information
- WordPress function not being called from jQuery method
- How can I add hyperlink in WP_Error message?
- wp_remote_get() returns 403 while file_get_contents() does not
- How to save inputed data in a textbox [EDITED] [duplicate]
- Replace default og:image tag YOAST
- WordPress Widget Not Saving Data
- WordPress Payment gateway add on form , how to add form into list or else how to submit form to next step for payment
- Center and hide overflow of WP toolbar custom links
- How to get my plug-in, wrote in php, to refresh on its own every 5 minutes?
- How I can internationalize variables within the function _e () __ (), etc?
- Conditional tag doesn’t work in WordPress plugin
- PHP Fatal error: Call to a member function locale() on a non-object
- How can i force wp-admin to use 2-column dashboard layout? [closed]
- Are there action hooks for comments?
- syntax error, unexpected ‘while’ (t_while) please help :)
- coding a WordPress AJAX Form using PHP to check if User is Logged Out and Show error
- Plugin onclick button activate other plugin
- Show icons or badges under title on product archives/category pages
- How to redirect non www to www? [closed]
- WordPress custom post type image in RSS
- Inserting Plugins Into Blank Space of Externally Designed WordPress Theme
- Add logo to admin menu in my plugin
- Plugin not working locally, but works on server
- Disable Checkbox depending on state of another checkbox
- Get data from wp_posts of mysql in to variables of wordpress-php script
- WordPress plugin won’t create custom tables
- Trying to get property of non-object wordpress error message
- Advertising: Every page refresh counts as 3 ad impressions
- Somehow adding to “Insert Into URL” posts are contradicting each other
- Pasting this PHP breaks my page. Why?
- Check against server time to display SQL entries – Radio Station DJ Rotator Plugin
- WordPress Cache delete on plugin uninstall
- How to create repeater field manually, without plugin (ACF Pro)?
- can’t unzip file
- How to disable login in iframe which is hosted in same domain?
- Display Author name PHP (Selfmade Plug-IN)
- WordPress jQuery Post – Amending Variable Value Within Function Command
- how to display recent post by category on home page
- WordPress Custom Hook with Class method
- Display top level parent category as a single product body class (Woocommerce)
- Allow a particular user to access a particular plugin?
- Auto delete empty posts
- Change plugin descriptions
- Change the address of the music player if not available
- WordPress hide post from custom post-type on a single page
- How can I find related learndash course id from woocommerce product object?
- update_post_meta is not working for me when I use e.preventDefault for update button
- Try to debug a plug-in written by someone else
- How to use Datatable with Ajax when creating plugin on WordPress?
- Add a WooCommerce Product Variant with attributes programmatically
- Showing how many times is plugin activated or deactivated
- Site broken by unedited php?
- get/show Last ID
- Plugin communication between sites that use it?
- Form tries to download a file on submit
- insert multiple entries in database using a loop issue
- Query Shortcode from a multisite to appear on a different site?
- How to echo a plugin’s function into a template?
- Retrieve data from multiple WordPress sites using PHP script
- Trending Tags based on post views
- What is the process for reimplementing a back up WordPress?
- Showpost and last
- date function not correctly returning date
- Edit Buddypress Groups Activity Page Text [closed]
- Undefined variable _POST
- I want to remove the register/login WordPress top bar from my website
- How to prevent page load on form submission
- how to add “alt” for all image in wordpress
- WordPress: code structure
- Need help with wordpress audio preload
- Allow direct access to files/folders within WordPress to replace wp-admin
- Make plugin admin page visible to other roles
- Is there any WordPress Plugin that provides video editing from front end side? [closed]
- How Create LastMod and Update Date Only on Taxonomy Category and Tags
- Accessing Correct Database to Create REST API Endpoint
- How do I replace a logo image that’s hard-coded into a plugin’s logo.php file?