Okay
  Public Ticket #3617665
Wordpress Query & Table Category/Taxonomy Issues
Closed

Comments

  •  1
    Nathan Hamilton started the conversation

    I am running into some issues when attempting to create a table using the Wordpress query approach. I can select the Post and Post Properties to display in a table. However, when I attempt to add Conditions no results are returned, even though there are live pages. 

    Here is what I'm trying to achieve:

    Included Posts, with Selected Properties of post.post_title and post.title_with_link_to_post

    Condition: post.taxonomy.category = Golfers or slug golf

    As you can see in the screenshots, I have entered those details into WP Data Tables, there are posts published in the Golfers category (golf slug), and WP Data Tables returns a No Results Found error when attempting to create the table.

    Note, I can create a table of all posts with the conditions removed, just not when adding a taxonomy or category condition.

    I am hoping to figure out the issue or where I'm going wrong so I can create more tables using categories and custom taxonomies I've created, all of which haven't worked in my testing and receive the No Results error.

    Attached files:  Screenshot 2024-03-29 at 10.43.02 AM.png
      Screenshot 2024-03-29 at 10.42.47 AM.png
      Screenshot 2024-03-29 at 10.41.52 AM.png

  •  1
    Nathan Hamilton replied

    I can provide temporary user credentials should you need them.

  •  1,846
    Miloš replied

    Hi Nathan,

    Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusually high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.

    -

    As the custom posts/fields/taxonomies, are a part of the WordPress database;

    pulling this data can only be done through MySQL query-based tables.

    Please note: Using this plugin feature requires at least a basic knowledge of SQL. It is assumed that you can create the table in some MySQL data manager (e.g., PHPMyAdmin, MySQL Workbench), and prepare a SQL query that will return the data you need. 

    A good way to achieve this can be experimenting using our WPDB SQL Query Constructor tool.

    You can also try this other SQL Query helper Tool,

    Create a MySQL-query-based table by querying a database,

    that one has a wider range of all tables you can choose from your Database outside of WPDB.


    - Please note: this tool is not an ultimate query generator. It simply constructs a suggestion of a query. We are constantly working to improve it, but SQL is such a complicated and flexible language that full automation for constructing queries is next to impossible. 

    Consequently, the more complicated the query, the higher is the probability that it will not return exactly what you need. So, you will often need to play around with the resulting query.


    Please be advised that writing custom SQL Queries or debugging Queries does not fall under what our support covers.

    You can check out this official page of WP codex,  for help with writing custom Queries.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  1
    Nathan Hamilton replied

    Hi Milos, I don't know if I follow exactly.

    I've included a screenshot for clarification. Are you saying to create the table via Generate a Table Via Query to MySQL Database or via Generate a Query to the WP Database, or either?

    The links provided suggest using either approach. In my initial attempt, I was using the latter WP Database option.

    Attached files:  Screenshot 2024-04-02 at 2.05.53 PM.png

  •  1,846
    Miloš replied

    Hi Nathan,

    Yes. Generally speaking, you should be able to achieve the result with either of these methods, whether it is the first choice that has the "WPDB" structure or the second choice is a more 'generic' MySQL query generator .

    As mentioned in the introduction part for both Documentation Pages:

    1.  The “WPDB” Constructor helper tool is perhaps more suitable for what you're trying to achieve.

    I will just quote the part from the Documentation about this :

    The structure familiar to users, is based on different post types, post custom (meta) fields, and taxonomies; all stored in a collection of MySQL tables. 

    Querying these elements, however might be somewhat of a headache to someone not that familiar with relative database structures and building SQL queries.

    wpDataTables has a built-in WPDB query constructor to help those users. It has a graphical user interface which allows a user to pick the post types, custom/meta fields, and taxonomies, and generates a query and a preview. 

    You can modify the query as needed, and create a wpDataTable based on the modified query.


    And, we have to take the important note again :

    this tool is not an ultimate query generator. It simply constructs a suggestion of a query.

     We are constantly working to improve it, but SQL is such a complicated and flexible language that full automation for constructing queries is next to impossible. 

    Consequently, the more complicated the query, the higher is the probability that it will not return exactly what you need. 

    So, you will often need to play around with the resulting query.


    2. On the other hand, the other generic MySQL query generator Constructor Tool, which you tried already, is perhaps better suited when we are trying to pull data from 'classic structured' SQL Tables, which are more custom Tables, rather than having the "WordPress DB" structure type.

    But it can achieve the result, it just has a different way how it shows you the SQL tables when you pick them through the interface.


    So, to summarize, I would say the first choice will be better if you are just looking to pull data from the WPDB structure, such as post types, custom/meta fields, and taxonomies.


    But then, it gets more complex the more details you add to the Query such as adding specific conditions, etc.


    You can check online on various places such as Stack Overflow;

    and this official page of WP codex,  for help with writing custom Queries, where you might find posts of other users who achieved a similar use-case.


    Our Support is not covering writing or debugging Custom Queries, but I hope this might help to get you started in the right direction.

    Thank you.


    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  1
    Nathan Hamilton replied

    Thank you. I will look into hiring a developer to help build the queries. Do you guys have any recommendations for firms/developers you work with that are familiar with SQL and its use with WP Data Tables? No worries if not.

  •  1,846
    Miloš replied

    Hi Nathan,

    Unfortunately, we don't currently have anyone we could recommend for something like that.

    If any of our developers become available anytime soon, or if we find anyone else to recommend, I will make sure to report back and send the contact to you.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables