Skip to content
Advertisement

Wrong author ID output from elementor module

I create a module for elementor. I need to display the author name, choosen from the elementor admin control. I have 4 administrator. They show up correctly on control panel:

  1. admin (ID=0.)
  2. Jhon Doe (ID=1.)
  3. Jeane Doe (ID=3.)
  4. Mary Doe (ID=5.)

The code for Elementor admin panel:

JavaScript

When I choose Jeane Doe from Elementor control admin, the output on the frontpage display the wrong author ID (1, and Jeane Doe ID is 3). Not the author name which I need.

The code for the output:

JavaScript

Really appreciate for any helps.

Advertisement

Answer

Change

$author_list[] = $user->user_nicename;

to

$author_list[$user->ID] = $user->user_nicename;

See: Arguments section here: https://developers.elementor.com/elementor-controls/select-control/

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement