How to sort wordpress posts already selected by WP_QUERY

I found the way how to reorder already selected posts. For exapmle, we have selected posts: $qargs = array( ‘posts_per_page’ => 15, ‘no_found_rows’ => true, ‘order’ => ‘DESC’, ‘post_type’ => ‘post’, ‘suppress_filters’ => false, ‘orderby’ => ‘post_views’, // here I order my posts by views ‘fields’ => ”, ‘date_query’ => array( array( ‘after’ => ‘-7 … Read more

Custom Taxonomy – Modify Function to Get Child Category

if it is for product categories, this function only needs the category id to know the childrens: function cat_childs( $term_id = 0) { $children = get_terms( array( ‘child_of’ => $term_id, ‘taxonomy’ => ‘product_cat’, ‘hide_empty’ => true, ‘fields’ => ‘ids’, )); return ( $children ); } can be called like this: cat_childs(1234); because it can return … Read more

Why last row deleted when refresh page

I think the reason for the error is you are not creating a form for it, so the last result being used in the foreach is assigning that $print->id to $id. If you did this foreach ( $result as $print ) { ?> <tr> <form method=”POST” action=”{page url}”> <td><?php echo $print->id; ?></td> <td><?php echo $print->names; … Read more