Pono Press

  • Tutu – Block Theme
  • Plugins
  • Guides
  • Support
  • Blog

Get Started
  • How to Add Custom Attributes (Author, Category, Tags) to the Index and Show Them?

    Why add custom attributes?

    Search is often more than just finding words in a title or content. In real-world sites, users want to search by categories, see who wrote a post, or even browse by tags. That’s why extending the search index with custom attributes is so valuable — it makes results richer and more useful.

    In fact, one of our users recently asked for this feature on the WordPress.org support forums: How to add custom attributes (author, category) to the index?. That discussion inspired us to write this guide and show exactly how you can do it using the new yuto_modify_documents_data hook in Yuto Search.

    Step 1: Enqueue Your Custom JavaScript File

    Since Yuto Search exposes WordPress-style JavaScript hooks, the first step is to load your own JS file into the admin so you can hook into them. You’ll do this by enqueuing a custom script in your plugin or theme.

    Here’s an example in PHP:

    Once this is enqueued, you’re ready to start writing JavaScript that interacts with Yuto’s indexing process.

    Step 2: Write the Hook in JavaScript

    Now that your custom-admin-scripts.js file is loaded into the admin, you can use WordPress’ JS hooks to modify the data before it’s sent to Meilisearch. The new filter yuto_modify_documents_data introduced in 0.1.3 lets you add or change attributes for each document being indexed.

    Since you want the result to be searchable by categories, you need to add it to the searchable attributes using the hook yuto_searchable_attributes

    Here’s a simple example that adds the categories of a post:

    Step 3: Re-index Your Data

    Because the hook runs inside the WordPress admin, it only affects the data at the moment a post is indexed (on save, update, or delete). That means your existing content won’t magically get the new attributes—you’ll need to re-index it.

    👉 After re-indexing, head over to your Meilisearch dashboard (or use the API) to confirm that your documents now contain the new fields.

    Step 4: Show Custom Attributes in Frontend Search Results

    Once your documents are re-indexed with the new attributes, the next step is to display them in your search results. You can customize the item templates to include categories, tags, or author names.

    This JS file don’t need to be enqueued on the admin. You can enqueue like any normal frontend JS file.

    Here’s a simple example for it:

    With this final step, your search results are now fully enriched, showing categories custom attribute you added via the hook. You can do the same for other attributes like: tags, authors and more.

    Summary

    By using the new yuto_modify_documents_data hook, you can easily enrich your Meilisearch index with custom attributes like author names, categories, tags, or any other metadata. The process is simple:

    1. Enqueue a custom JS file in the admin with wp-hooks and wp-api-fetch dependencies.
    2. Write a hook in JS to modify the document data before it’s indexed.
    3. Re-index your content so existing posts include the new attributes.
    4. Customize your frontend templates to display the enriched data in search results.

    This approach gives you full control over your search data, enabling more meaningful results, and a richer user experience. Whether you want users to see authors, search by category, or explore tags, Yuto makes it easy to extend the index exactly the way your site needs.

    ponopress

    August 22, 2025
    Tutorials, Yuto
    meiliesearch, tutorials, update, yuto
  • 🎉 Yuto 0.1.1 Released – Shortcode & Elementor Support Now Available!

    🎉 Yuto 0.1.1 Released – Shortcode & Elementor Support Now Available!

    We’re excited to announce the release of Yuto version 0.1.1, and it comes packed with powerful new features that make integrating lightning-fast Meilisearch into your WordPress site easier than ever.

    Whether you’re using the Classic Editor, Elementor, or any other site builder, Yuto now fits seamlessly into your workflow.

    ✨ What’s New in 0.1.1

    You can now render the Yuto Autocomplete search anywhere on your site using the [yuto_autocomplete] shortcode. It’s perfect for sites that don’t use the Site Editor or prefer working in the Classic Editor, widgets, or page builders.

    Example Usage:

    [yuto_autocomplete]

    With Custom Options:

    [yuto_autocomplete enabled_indices="post,page" placeholder="Search..." auto_focus="true" open_on_focus="true" results_panel_placement="full-width"]

    Available Attributes

    You can read about the available attributes for the shortcode detailed in the Shortcode Documentation.

    PHP Example:

    echo do_shortcode('[yuto_autocomplete]');

    This makes it easy to include search in your theme header, sidebar, or anywhere you want!

    Elementor Integration via Shortcode

    Yuto now works beautifully inside Elementor using the Shortcode widget. No custom block or addon required.

    How to Use:

    1. Open your page in Elementor.
    2. Drag the Shortcode widget where you want to add search.
    3. Enter [yuto_autocomplete] in the input field.
    4. Update the page — done!

    This is perfect for adding search boxes in Elementor-built headers, product pages, or landing pages.

    Why This Matters?

    • No Block Editor? No Problem. You can now use Yuto’s powerful search even if your site uses the Classic Editor or other builders.
    • Maximum Flexibility. Developers and site builders can render search in templates, sidebars, headers, or anywhere using do_shortcode().
    • Easy Integration. Elementor users can integrate Yuto in seconds using the native Shortcode widget.

    Be sure to check out the new features and streamline your WordPress management tasks with Yuto!

    ponopress

    June 9, 2025
    Announcement, Yuto
    meiliesearch, update, yuto
  • Yuto Plugin Release 0.1.0: Introducing WP-CLI Support 🖥️

    Yuto Plugin Release 0.1.0: Introducing WP-CLI Support 🖥️

    We are excited to announce the release of Yuto Plugin version 0.1.0, which now includes support for WP-CLI! 🎉 For those unfamiliar, WP-CLI is a powerful command-line interface for managing WordPress installations, making it an essential tool for developers and administrators looking to streamline their workflow.

    What’s New?

    With this integration, Yuto empowers users to efficiently perform various tasks directly from the command line, such as indexing and deletion. This enhancement not only improves productivity but also opens up new possibilities for automation, allowing seamless execution of commands in scripts and integration with other automation tools. 🛠️

    WP-CLI Command Details

    Yuto introduces the following WP-CLI commands:

    NAME

    wp yuto

    DESCRIPTION

    Yuto CLI Commands.

    SYNOPSIS

    wp yuto

    OPTIONS

    • <action>: Action to perform. Options include:
      • build-index
      • delete-index
      • add-documents
    • <post-type>: Specify the post type to act upon.
    • [--ids=]: A comma-separated list of post IDs to index (only for add-documents).

    EXAMPLES

    Here are some examples of how to use the new commands:

    Build an index for a specific post type:

    wp yuto build-index post_type
    

    Delete the index for a specific post type:

    wp yuto delete-index post_type

    Add documents to the index for a specific post type:

    wp yuto add-documents post_type --ids=1,2,3

    Delete documents from the index for a specific post type:

    wp yuto delete-documents post_type --ids=1,2,3
    

    The addition of WP-CLI support in Yuto Plugin version 0.1.0 significantly enhances its functionality, providing developers and administrators with the tools they need to manage their WordPress sites more effectively. Whether you’re looking to index documents or delete documents from Meilisearch, Yuto’s CLI commands make it easier than ever to automate your workflow. 🌟

    Be sure to check out the new features and streamline your WordPress management tasks with Yuto!

    ponopress

    March 2, 2025
    Announcement, Yuto
    meiliesearch, update, yuto
  • Increasing Batch Size for Faster Performance 🚀

    Increasing Batch Size for Faster Performance 🚀

    Why Increase the Batch Size?

    If you have a large number of posts, pages, or custom post types that need indexing, the process can take significant time. Increasing the batch size can help reduce indexing time by processing more documents per batch.

    By default, Yuto indexes up to 999 documents per batch because larger batches process faster than smaller ones. For example, indexing 100,000 documents in 2 batches of 50,000 is much quicker than using 4 batches of 25,000. However, Meilisearch limits the maximum payload size to 100MB, which is why the default batch size is set to 999.

    Enqueuing the JavaScript File for the Yuto Settings Page

    To apply these changes, you need to enqueue the JavaScript file containing the hooks on the Yuto settings page.

    How to Increase the Batch Size

    Starting from version 0.0.7, you can increase the batch size using the yuto_index_batch_size hook. This hook accepts two parameters:

    Parameters:

    • batchSize (Integer) – Defines the batch size. Default: 999
    • UID (String) – The index ID.

    Example Usage:

    Important Note:

    Re-indexing is necessary for the changes made through this hook to take effect.

    Increasing Beyond 999: Adjusting the REST API Limit

    By default, the WordPress REST API restricts per_page to 100 posts per request. Yuto increases this limit to 999 for all post types. If you want to use a batch size higher than 999, you must first adjust the REST API’s per_page limit.

    Adjusting the REST API per_page Limit

    Use the rest_{$post_type}_collection_params filter to increase the maximum per_page value.

    Once this change is applied, you can use a batch size greater than 999 within the yuto_index_batch_size hook.

    Summary

    • The default batch size is 999, but it can be increased using the yuto_index_batch_size hook.
    • To exceed 999, update the WordPress REST API’s per_page limit.
    • Ensure that JavaScript hooks are properly enqueued on the Yuto settings page.
    • Ensure to Index the documents again for the changes to take effect.

    By following these steps, you can optimize your indexing process for better performance in Yuto. 🚀

    ponopress

    January 29, 2025
    Tutorials, Yuto
    meiliesearch, tutorials, update, yuto
  • Introducing Yuto 0.0.4: New Features and Enhancements

    Introducing Yuto  0.0.4: New Features and Enhancements

    We are excited to announce the release of version 0.0.4, which brings a host of new features and improvements to enhance your experience. Here’s a detailed look at what’s new in this update:


    Important Note

    With new version, please be aware that the Autocomplete Block will display an “Attempt Block Recovery” warning in the Editor. If you encounter this warning, simply click the button provided to resolve the issue. This will ensure that the block functions correctly and continues to perform as expected.


    1. Include Featured Images in the Default Search Results

    In version 0.0.4, we’ve added support for including featured images in the default search results. This means that when users perform a search, the results will now display relevant featured images alongside other search information. This enhancement helps provide a richer and more visually appealing search experience, making it easier for users to find and recognize content.


    2. Index Documents During Post Updates, Deletions, and Bulk Edits

    To ensure that your search index remains up-to-date, we have introduced functionality to index documents automatically during post updates, deletions, and bulk edits. This means that any changes you make to your content will be reflected in your search index without needing additional manual intervention. This feature streamlines content management and ensures that search results are always current.


    3. Display a Loading Indicator While Indexing and Deleting Documents

    Version 0.0.4 introduces a new loading indicator that appears while indexing and deleting documents. This visual cue informs users that the system is processing their request, helping to improve the overall user experience. By providing clear feedback during these operations, we make it easier for users to understand the status of their actions and reduce any potential confusion.


    4. Enable Indexing for All Available Post Types (Excluding Default Types)

    We’ve expanded the indexing capabilities to support all available post types, except for default types like navigation, media, and others. This enhancement allows for greater flexibility in indexing content, enabling users to include a wider range of custom post types in their search indices. This means that any plugins providing custom post types, they can now be indexed and searched more effectively.


    5. Add Support for WooCommerce

    We’re pleased to announce that version 0.0.4 now includes full support for WooCommerce. This integration allows you to index your WooCommerce products directly into Meilisearch, providing a seamless search experience for your e-commerce store. With this update, you can ensure that product details are accurately indexed and easily searchable, enhancing the overall shopping experience for your customers.


    6. Add Autocomplete Theme Color Option for Block

    Finally, we’ve added a new theme color option for the autocomplete block. This feature allows you to customize the appearance of the autocomplete dropdown to match your site’s design aesthetics. You can now set a theme color that aligns with your branding, providing a more cohesive and visually integrated search experience.


    We hope you enjoy these new features and improvements in version 0.0.4. As always, we welcome your feedback and are committed to continually enhancing our product to meet your needs. Stay tuned for more updates and improvements in the future!

    ponopress

    September 7, 2024
    Announcement
    meiliesearch, update, yuto

Looking for Help?

Browse our Documentation or contact Support to get your questions answered. To report a bug, please post to our GitHub Issue Tracker.

See our Terms & Conditions for licensing and refund details.

Pono Press

  • Terms & Conditions
  • Guides
  • Support

Copyright@2020 Pono Press

Powered by crazy ideas and passion.