Issue
Here is a where clause I have:
->where( 'post_type', '=', 'blog' )
Is there any way to replace 'blog' by a wildcard, so it will match any 'post_type' ?
Full query:
$db = ( new DbSql() )->db()->getConnection();
$postsCount = $db->table( 'posts' )
->where( 'status', '=', 'published' )
->where( 'post_type', '=', 'blog' )
->where( 'alerts', '<', Settings::CONTENT_ALERT_NUMBER_ALLOWANCE )
->count() ?? null;
Solution
Use like:
->where('post_type', 'like', '%'.$string.'%')
Answered By - Alexey Mezenin
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.