With that in functions.php
you’d probably have to declare $error
to be global
like so :
if ('POST' == $_SERVER['REQUEST_METHOD'] && !empty($_POST['action']) && $_POST['action'] == 'registration') {
global $error;
$error = new WP_Error();
// the rest of your code
And then do global $error;
again on your registration page before trying to use it.
But I don’t understand why you have that code in functions.php
. That seems like bad design to me. You are running that if
conditional every time any page loads and it sounds like you only need it on your registration page, which I am assuming is something you’ve written yourself and that you are not talking about the built in registration/login page at wp-login.php
. Given that assumption, just move that code to the registration page and it will be available with no hassle. WP_Error
has methods will let you get at the data.
Related Posts:
- wp_enqueue_script was called incorrectly
- Add multiple custom fields to the general settings page
- Remove type attribute from script and style tags added by WordPress
- Adding fields to the “Add New User” screen in the dashboard
- Get the ID of the page a menu item links to?
- Disable visual editor on one specific page
- How to add first name & last name to default registration form?
- How can I programmatically create “child” pages on theme activation?
- Create new user without password
- Slugs as breadcrumbs for Pages
- Check if has any sidebar active on current page
- Remove Page Title from Static Frontpage
- How to override WordPress registration and insert an auto-generated username?
- Target a certain page within wordpress backend (admin) i.e. Pages > About
- Breadcrumb how i can display page title with parent > child title with permalink ? any Idea
- Remove Menu Page Giving Error
- Restrict user registration to emails on a single domain
- Pages should have priority when using add_rewrite_rule
- Enqueuing Script in functions.php vs on the page
- Why when I instantiate wp_error in a validation method my user registration method stops working?
- Functions.php reverted to new one
- Remove default user registration, login and subscriber profiles
- Delete pages and Create default pages for all new network sites
- WordPress registration and contact form 7 [closed]
- how to change link of some wordpress pages
- Make menu structure match page heirarchy on page parent change
- Custom registration URL lost when user makes signup mistake
- Why is my Gutenberg block returning an error after initial save?
- Change the slug of a particular page every x hours
- wp_insert_posts keeps adding multiple pages
- Debugging with functions.php
- Batch update menu_order attribute alphabetically
- is_account_page() change to page slug
- Don’t delete a page if it holds users
- List all-childpages on parent-page AND list child-pages on childpage itself but not the current one?
- Display post shortcode content in the sidebar?
- Display alert on successful user Sign Up
- Why is my page feed returning empty content?
- Function only on a specific page
- Change label for registration Fields
- Warning: : DOMDocument::loadHTML(): Empty string supplied as input in functions.php when adding classes to post images
- Parse error after modifying the template menu [closed]
- Get page id or status by private pages?
- Multisite 404 on pages – rewrite error breaks database
- Registration Hooks don’t appear to be working
- help I changed one currency in woocommerce and everything is ruined [closed]
- Need help getting a function to function
- Connecting to a 2nd DB gives me no results when querying
- Trying to register script in footer
- debugging errors.. how to remedy?
- What is the text that appears beside the page titles in the list of pages in the WP admin?
- Functions Error: Impacting Galleries
- Is there a way to direct unregistered user to registration page when click a link?
- Enqueue script on every page except one
- Adding additional roles on registration
- How to store a number (coming from cookie) into query vars for later usage in other filters?
- Email Exists ERROR into Ajax registration form
- How do I register a new settings page? [closed]
- Only echo Page Content (not page title & page content together)
- Strange error from functions.php files (wp_register_script)
- call wp_insert_user in custom class doesnt work
- get content from page through AJAX
- How to setup a popup registeration page in wordpress with function.php
- Show errormessages on wrong username/password on custom loginform?
- Problems with functions.php! Error! [closed]
- Looking for Functions File that doesn’t Exist
- How to assign php file(template) to several pages with same prefix page name/slug
- functions.php pharse error on complete new install
- Allow user select role in wordpress default registration without plugin
- Unable to login after registration
- “Conditional query tags do not work before the query is run. Before > then, they always return false. “
- Remove the delete link from pages without a plugin
- MCAPI.class.php showing some error
- Change is_front_page() to is_page() to display ‘hero’ on entire site?
- I’m getting invalid taxonomy in init action
- Set display name from nickname with register process
- Restrict certain roles registrations by domain
- Translation Function missing text-domain [closed]
- Changing the register url is not working
- Define an extra field for all pages (with no plugin?)
- What is wrong with functions.php? Fills error log with same error
- Custom field not updating via functions upon publishing
- disable WP_error: authentication_failed
- Problem in outputting shortcode
- Problem in shortcode outputting content
- Mail function not working with user accounts
- Random text changing to weird icons in both admin & front end
- Register a widget area when a theme option has been saved?
- jQuery HoverIntent is not a function
- create submenu page – error function not found or invalid function name
- Using array page name together with page id to deregister script
- How to add a class name to the ancestor of a post?
- Why does modifying my functions.php file always result in a server error
- How to add an excerpt and read more link to a page?
- Notice: Use of undefined constant REQUEST_URI – assumed ‘REQUEST_URI’ in ….functions.php on line 73
- Woocommerce – Checkout error message
- Help finishing script to export WP user data when form submitted
- How to fix enqueue_styles error for a twenty-seventeen childtheme
- Comment turned Invisible
- Convert Image to Webp on upload without plugin