“Missing argument 2 for _x()” error in WordPress

Has your WordPress website randomly developed a “Warning: Missing argument 2 for _x()” error? All you may need is to rename the _x() function.

Change the _x() function to __()

_x() is a function which requires 2 arguments. Meaning, you’re most likely getting an error due only passing through 1 of these.

To fix this, follow the steps below:

  1. Open the file and go to the specific PHP line that the error has occurred in.
  2. Locate the _x() function on this line.
  3.  Replace this with the __() function.

Note, you don’t need to replace all of these, but only the errors your server is showing. This is because some of these may already have the 2 arguments passing through them.