Home › Forums › Front-end Issues › Querying all posts send by non-login user to a specific author › Reply To: Querying all posts send by non-login user to a specific author
As I said, it depends on how you set it. For example, if you have a post for a company, you can use the user field to set the user associated with that post. Then I believe you can get the company’s user ID like this:
global $post; $company_id = get_field('company_user_field_name', $post->ID, false);
If that doesn’t work, you can always add hidden input by using the
html_after_fields option like this:
'html_after_fields' => '<input type="hidden" name="companyid" value="'. get_the_ID() .'">',
And then get the company ID like this:
$company_id = get_field('company_user_field_name', $_POST['companyid'], false);
Also, could you please try to set the
$company_id manually to your account’s ID and check if the query shows the messages for you?
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!