WordPress.org

Make WordPress Core

Opened 11 months ago

Closed 6 months ago

#48678 closed defect (bug) (invalid)

Problem with $tag V5.3

Reported by: pajtim Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.3
Component: Query Keywords:
Focuses: Cc:

Description

Hi me and many others have a problem with the latest wordpress update.
This is about $tag.
$tag does not work and gives me this message:

[17-Nov-2019 01:15:14 UTC] PHP Warning:  array_map(): Argument #2 should be an array in /home/name/public_html/web/wp-includes/class-wp-query.php on line 2069
[17-Nov-2019 01:15:14 UTC] PHP Warning:  implode(): Invalid arguments passed in /home/name/public_html/web/wp-includes/class-wp-query.php on line 2069
[17-Nov-2019 01:15:14 UTC] WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') AND ( 
  wpuw_term_relationships.term_taxonomy_id IN (9)
) AND ( 
  wpuw_postm' at line 1 for query SELECT SQL_CALC_FOUND_ROWS  wpuw_posts.ID FROM wpuw_posts  LEFT JOIN wpuw_term_relationships ON (wpuw_posts.ID = wpuw_term_relationships.object_id) INNER JOIN wpuw_postmeta ON ( wpuw_posts.ID = wpuw_postmeta.post_id ) WHERE 1=1  AND wpuw_posts.ID NOT IN () AND ( 
  wpuw_term_relationships.term_taxonomy_id IN (9)
) AND ( 
  wpuw_postmeta.meta_key = 'ecpt_toparticle'
) AND wpuw_posts.post_type = 'post' AND (wpuw_posts.post_status = 'publish' OR wpuw_posts.post_status = 'private') GROUP BY wpuw_posts.ID ORDER BY wpuw_posts.post_date DESC LIMIT 0, 5 made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/mydesign/category.php'), WP_Query->__construct, WP_Query->query, WP_Query->get_posts

In this situation the select does not work in TAG:

<option value="?tag=usa" <?php if ($tag == usa) echo 'selected="selected" ';?>>Usa</option>

var_dump($cat); return Nothing and var_dump($tag); return Category.

In category.php code:

<?php
$args = array(
    'meta_key'=> 'ecpt_toparticle',
    'showposts' => 5,
    'category__in' => $cat,
    'post__not_in' => $tag
);
$sticky_query = new WP_Query( $args );
while ( $sticky_query->have_posts() ) : $sticky_query->the_post();
?>

In this case I have returned wordpress 5.2.4
Thanks,
Pajtim

Change History (1)

#1 @SergeyBiryukov
6 months ago

  • Component changed from General to Query
  • Keywords $tag removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Severity changed from critical to normal
  • Status changed from new to closed

Hi there, welcome to WordPress Trac! Thanks for the report, sorry it took a while for someone to get back to you.

It's not quite clear where the $tag variable in your example comes from.

var_dump($cat); return Nothing and var_dump($tag); return Category.

If you're passing the $tag value to the post__not_in parameter, it needs to be an array, not a string.

As far as I can see, there's no bug here. Please note that this Trac is used for enhancements and bug reporting for the WordPress core software, not for individual support questions.

Please try the support forums to get help with your site: https://wordpress.org/support/forums/

Feel free to reopen with steps to reproduce on a clean install if it turns out to be an issue in WordPress core.

Note: See TracTickets for help on using tickets.