Giter VIP home page Giter VIP logo

5um17 / wp-extended-search Goto Github PK

View Code? Open in Web Editor NEW
20.0 20.0 4.0 278 KB

Extend default search to search in selected post meta, taxonomies, post types and all authors.

Home Page: https://www.secretsofgeeks.com/2014/09/wordpress-search-tags-and-categories.html

License: GNU General Public License v3.0

PHP 94.04% CSS 1.21% JavaScript 4.75%
php search wordpress wordpress-plugin wordpress-search wp-extended-search wp-plugin

wp-extended-search's People

Contributors

5um17 avatar alexclassroom avatar dependabot[bot] avatar robbertdk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

wp-extended-search's Issues

Plugin Settings Menu Add Error for Non Manage-Options users

Just wanted you to know that your recent update to 2.0 caused a bunch of errors to show up on the admin screen for users that do not have "manage_options" in their user role. Something in the constructor file you have that adds the wp-extended search to the menu nav vs in the previous versions you had it showing under the settings menu. I have a few users that only have the ability to view the sites current users and modify them, not allowing them to see settings and other menu items. The recent update was throwing like 6 fatal errors. I had to rollback the plugin to the previous version then all the errors went away.

Empty search bug

When searching without a string in the input form, the results displayed are the default wordpress, this means that the plugin is useless in this situation. Is this a bug?

Can't search for tag and author when not logged in

Hi,

When searching for keyword in a password protected article, if the person who searches it is not logged in, then the returned result will not contain articles that includes the tag or published by author.
Is this a bug?

Thank you!

WordPress 6.0-RC1 causes WordPress database error

Hi,

I'm testing a theme and a few plugins to make sure they work in WordPress 6.0 when it is released, but I keep running into the following error when doing a search with your plugin activated:

WordPress database error: [Unknown column 'estt.taxonomy' in 'where clause']
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND ( ((wp_posts.post_title LIKE '%testing%') OR (wp_posts.post_content LIKE '%testing%') OR (wp_posts.post_excerpt LIKE '%testing%') OR (estt.taxonomy = 'post_tag' AND est.name LIKE '%testing%'))) AND ((wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private')) OR (wp_posts.post_type = 'page' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private'))) ORDER BY wp_posts.post_title LIKE '%testing%' DESC, wp_posts.post_date DESC LIMIT 0, 12

The error only appears when searching taxonomies is enabled.

The test environment is running the following:

  • WordPress 6.0-RC1
  • Twenty Twenty-Two Version 1.2 (theme)

Plugins:

  • WP Extended Search Version 2.1.1
  • Wordfence Security Version 7.5.9
  • WordPress Beta Tester Version 3.2.1
  • Force Login Version 5.6.3

On my production site running WordPress 5.9.3 with the same configuration (minus the WordPress Beta Tester plugin), this error does not occur... Please let me know if you need any more details.

Allow taxonomy search on product category to include category descriptions

Current implementation only search product category name. Please enable the search into the product category description when looking for post/product.

I am not a php or wordpress developer - so I don't really know how to properly test it with a php dev stack. So I just read the code and hacked it with one line change in the most recent release (2.1.1) and deployed the change directly to my site. If you would like me to do a pull request for this one-line change, I'd be happy to.

wp-extended-search/includes/class-wpes-core.php

diff --git a/includes/class-wpes-core.php b/includes/class-wpes-core.php
index ad4326c..5b5553c 100644
--- a/includes/class-wpes-core.php
+++ b/includes/class-wpes-core.php
@@ -425,7 +425,7 @@ final class WPES_Core {
 
                                        foreach ( $this->wpes_settings['taxonomies'] as $tax ) {
                                                $search .= $or . $tax_or;
-                                               $search .= $wpdb->prepare( '(estt.taxonomy = %s AND est.name LIKE %s)', $tax, $term );
+                                              $search .= $wpdb->prepare( '(estt.taxonomy = %s AND (est.name LIKE %s OR estt.description like %s))', $tax, $term, $term );
                                                $or      = '';
                                                $tax_or  = ' OR ';
                                        }

Filtered search by multiple post_types Array to String conversion error

Problem Description

image

I had a search page where the user can filter the results by taxonomies. The client asked to add filtering by content type. I thought it would be easy, but it kept giving me "array to string conversion" errors. The checkboxes are configured with name="taxonomy[]" in order to pass multiple values.

My Extended Search configs:

image

Solution

I ended up tracing the issue to /includes/class-wpes-core.php:283. That line didn't account for the possibility that the $_GET might be an array.

It was late and I ran out of debugging steam, but it wasn't working just using the array, but it worked by imploding it and then exploding it so I went with that.

I'm pretty new to Wordpress and I'm a bit unclear how I keep this change in my filesystem without it being overwritten every time there is an update so I'm hoping this issue flag can help lead to a long-term fix to the plugin. Super happy to help, hit me up if you have any questions.

Patch:

diff --git site/web/app/plugins/wp-extended-search/includes/class-wpes-core.php site/web/app/plugins/wp-extended-search/includes/class-wpes-core.php
index ad4326ca..9cdb5acf 100644
--- site/web/app/plugins/wp-extended-search/includes/class-wpes-core.php
+++ site/web/app/plugins/wp-extended-search/includes/class-wpes-core.php
@@ -283,8 +283,13 @@ final class WPES_Core {

      // Set post types.
      if ( ! empty( $this->wpes_settings['post_types'] ) ) {
-				if ( isset( $_GET['post_type'] ) && in_array( esc_attr( $_GET['post_type'] ), (array) $this->wpes_settings['post_types'], true ) ) {
-					$query->query_vars['post_type'] = (array) esc_attr( $_GET['post_type'] );
+				$attr =  isset($_GET['post_type']) ? $_GET['post_type'] : false;
+				$attr = is_array($attr) ? implode(',', $attr) : $attr;
+
+				if ( $attr && !is_array($attr) && in_array( esc_attr( $attr ), (array) $this->wpes_settings['post_types'], true ) ) {
+					$query->query_vars['post_type'] = (array) esc_attr( $attr );
+				} elseif ( $attr && is_string($attr) ) {
+					$query->query_vars['post_type'] = (array) explode(',', $attr);
        } else {
          $query->query_vars['post_type'] = (array) $this->wpes_settings['post_types'];
        }

Cannot search for product tags that are and’ed together

I’m working on a woocommerce site. My WP Extended Search pluggin has these settings (https://ibb.co/f0XqPTF)

  • optimized for products search
  • select taxonomies: “product categories” and “product tags”
  • select post types: products
  • Terms relation type: AND

For the most part, it works well on combination of keywords from tag/category/description/title etc. However, say, a product has two tags: tag1 and tag2, and if I search for “tag1 tag2” the result would not return.

pre_get_posts hook is overriding query

pre_get_posts hook is overriding the wp_query for other plugins & showing default posts instead of the actual post type list.

Please make it specific so it wouldn't impact for other plugins.

You can try Simple Job Board to reproduce the bug.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.