1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How do I query node sort by randomize?

Discussion in 'Programming/Internet' started by Jesse Heisenberg, Oct 8, 2018.

  1. I want to get all articles content type, but I want to get it randomize, how can I do that? Refer to my code below:

    $nids = \Drupal::entityQuery('node')->condition('type', 'articles')->sort('RAND()')->execute();


    I'm using drupal 8

    Login To add answer/comment
     

Share This Page