• Resolved tropicalista

    (@tropicalista)


    A follow up to this: https://wordpress.org/support/topic/link-suggestions-when-adding-links-gutenberg-editor/

    I really like the plugin, however the gutenberg suggestion missing is a minus.

    I’ve seen an issue on Gutenberg, but doesn’t seems it got enough traction.

    Iìm not sure why you choose to go with custom table instead of add a custom post type.

    Would you consider adding something like this:

    add_filter(

        'rest_post_dispatch',

        function ( $result, $server, $request ) {

            if ( '/wp/v2/search' === $request->get_route() && 'post' === $request->get_param( 'type' ) ) {

                $res = $result->get_data();

                global $wpdb;

                $results = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM wp_clickwhale_links WHERE title LIKE %s', '%' . $wpdb->esc_like( $request->get_param( 'search' ) ) . '%' ) );        

                foreach ( $results as $link ) {

                    $res[] = array(
                        'id'      => $link->id,
                        'title'   => $link->title,
                        'url'     => $link->url,
                        'type'    => 'post',
                        'subtype' => 'Click Whale',
                    );

                }

                $result->set_data( $res );

                return $result;

            }

            return $result;

        },

        10,

        3

    );
Viewing 1 replies (of 1 total)
  • Plugin Support Mej de Castro

    (@mej)

    Hi @tropicalista,

    Thanks for getting in touch with us. We’ll consider this as a feature request and we’ll relay this to our development team for further consideration in the future updates.

    Thanks and let us know if you have other questions.

    Regards,
    Mej, from ClickWhale team

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