Answer the question
In order to leave comments, you need to log in
How to check for the author of a post?
Good evening.
Task: There is Petya (id=1) and Mitya (id=2) (two users). Both have one entry each.
Only if we go to Petya's entry, it will say This is Petya's entry.
And if we go to Mitina, then nothing will be written. (those records "This is Mitya's record" - should not be).
How to do this?
---
Upd.
I think it should start with<?php if (is_single() && is_author('1'))
Answer the question
In order to leave comments, you need to log in
is_author('1') - checks where we are and only fires for author's archives, in this case with ID = 1
respectively if (is_single() && is_author('1') will never return true
outside of the loop do this
Received ID further check and display or do not display what you need
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question