Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove get fields, cleanup code #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

herewithme
Copy link
Member

No description provided.

@herewithme
Copy link
Member Author

Sur un projet de nombreux modèles + beaucoup de champs, je gagne 0,3 sec sur chaque génération de page, non négligeable.

Copy link
Member

@petitphp petitphp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On peut directement passer l'objet WP_User à get_field et ACF gère automatiquement, sinon OK.

J'ai vérifié, get_field renvoi bien une meta même si ce n'est pas un champ register, donc pas de gros impact à l'utiliser tout le temps si disponible.

}

return get_field( $fields[ $key ], 'user_' . $this->get_id(), $format );
return get_field( $key, 'user_' . $this->get_id(), $format );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return get_field( $key, 'user_' . $this->get_id(), $format );
return get_field( $key, $this->user, $format );

@Rahe
Copy link
Member

Rahe commented Sep 17, 2024

Je crois que c'était fait comme ça parce que ACF gérait un peu mal les clés, mais ça me semble ^tre ok là avec la modification de Clément.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants