2

I want to add conditional statement in author. something like if the author is an admin set this to null. is this possible?

$args = apply_filters( 'job_manager_get_dashboard_jobs_args', array( 'post_type' => 'job_listing', 'post_status' => array( 'publish', 'expired', 'pending' ), 'ignore_sticky_posts' => 1, 'posts_per_page' => $posts_per_page, 'offset' => ( max( 1, get_query_var('paged') ) - 1 ) * $posts_per_page, 'orderby' => 'date', 'order' => 'desc', 'author' => get_current_user_id() )); 

2 Answers 2

4

I assume that get_current_user_id() is getting an id for author.

Change your code from this:

'author' => get_current_user_id()

With this:

'author' => ((get_current_user_id() == 'admin') ? NULL : get_current_user_id())

Sign up to request clarification or add additional context in comments.

Comments

0

I think you can use this sample code.

<?php $array = array('test' => testFunction()); function testFunction() { // do your condition here // return 'a'; } print_r($array); ?> 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.