Skip to main content
Commonmark migration
Source Link

As Milo ( and your errors ) point out: you're passing an array where a string is expected. According to WP_Query tag parameter

Show posts associated with certain tags.

 
  • tag (string) - use tag slug.

To get around this you just need to pass a comma separated string:

function custom_tags( $query ) {
    $query->set( 'tag', 'custom,general' );
}
add_action( 'pre_get_posts', 'custom_tags' );

As Milo ( and your errors ) point out: you're passing an array where a string is expected. According to WP_Query tag parameter

Show posts associated with certain tags.

 
  • tag (string) - use tag slug.

To get around this you just need to pass a comma separated string:

function custom_tags( $query ) {
    $query->set( 'tag', 'custom,general' );
}
add_action( 'pre_get_posts', 'custom_tags' );

As Milo ( and your errors ) point out: you're passing an array where a string is expected. According to WP_Query tag parameter

Show posts associated with certain tags.

  • tag (string) - use tag slug.

To get around this you just need to pass a comma separated string:

function custom_tags( $query ) {
    $query->set( 'tag', 'custom,general' );
}
add_action( 'pre_get_posts', 'custom_tags' );
Source Link
Howdy_McGee
  • 20.8k
  • 24
  • 91
  • 175

As Milo ( and your errors ) point out: you're passing an array where a string is expected. According to WP_Query tag parameter

Show posts associated with certain tags.

  • tag (string) - use tag slug.

To get around this you just need to pass a comma separated string:

function custom_tags( $query ) {
    $query->set( 'tag', 'custom,general' );
}
add_action( 'pre_get_posts', 'custom_tags' );