• Resolved davidgas

    (@davidgas)


    Hi, recently had to debug a site that returned an empty array [] when calling $tags = get_tags(array(‘taxonomy’ => ‘my_taxonomy’));. After tracing and debugging I’ve found Simple Custom Post Order to be the cause. The plugin is inserting a ORDER BY term_order but that column doesn’t exist in the DB so fails.

    I’ve installed previous versions, and found 2.4.4 the last version working correctly. Checked changes between 2.4.4 and 2.4.5 and this code is probably the cause (not checked):

    This is version 2.4.4:

    public function scporder_get_terms_orderby($orderby, $args) {
        if (is_admin())
            return $orderby;
    
        $tags = $this->get_scporder_options_tags();
    
        if (!isset($args['taxonomy']))
            return $orderby;
    
        if(is_array($args['taxonomy'])){
            $taxonomy = $args['taxonomy'][0];
        } else {
            $taxonomy = $args['taxonomy'];
        }
    
        if (!in_array($taxonomy, $tags))
            return $orderby;
    
        $orderby = 't.term_order';
        return $orderby;
    }

    This is version 2.4.5:

    public function scporder_get_terms_orderby($orderby, $args) {
        if (is_admin())
            return $orderby;
    
        $tags = $this->get_scporder_options_tags();
    
        if (!isset($args['taxonomy']))
            return $orderby;
    
        $taxonomy = $args['taxonomy'];
        if (!in_array($taxonomy, $tags))
            return $orderby;
    
        $orderby = 't.term_order';
        return $orderby;
    }

    Can you please check if I’m correct?

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support cristinnaiulia

    (@cristinnaiulia)

    Hello @davidgas,

    Thank you for bringing this to our attention!

    We’ve reviewed the code in the latest version, and it should work as expected. Please update to the most recent version (2.5.10), and don’t hesitate to let us know if you encounter any issues afterward.

    Warm regards,

    Cristina

    Plugin Support cristinnaiulia

    (@cristinnaiulia)

    Marking this support thread as resolved due to inactivity. If you have any other questions or need further help please open a new thread.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.