Forum Replies Created

Viewing 15 replies - 1 through 15 (of 22 total)
  • Thread Starter johnferz

    (@johnferz)

    Also please explain this error on custom endpoint caching.

    Fatal error: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, string given in /home/i/imstest1/imstest1.ru/public_html/wp-content/plugins/wp-rest-cache/includes/caching/class-caching.php:936 Stack trace: #0 /home/i/imstest1/imstest1.ru/public_html/wp-content/plugins/wp-rest-cache/includes/caching/class-caching.php(936): array_key_exists(‘id’, ‘\n{“filterHtml”:…’) #1 /home/i/imstest1/imstest1.ru/public_html/wp-content/plugins/wp-rest-cache/includes/caching/class-caching.php(815): WP_Rest_Cache_Plugin\Includes\Caching\Caching->determine_object_type(Array) #2 /home/i/imstest1/imstest1.ru/public_html/wp-content/plugins/wp-rest-cache/includes/caching/class-caching.php(173): WP_Rest_Cache_Plugin\Includes\Caching\Caching->register_endpoint_cache(’70ae2e6ace25eb5…’, Array, ‘/wp-json/wp/v2/…’, Array, ‘GET’) #3 /home/i/imstest1/imstest1.ru/public_html/wp-content/plugins/wp-rest-cache/includes/api/class-endpoint-api.php(275): WP_Rest_Cache_Plugin\Includes\Caching\Caching->set_cache(’70ae2e6ace25eb5…’, Array, ‘endpoint’, ‘/wp-json/wp/v2/…’, ”, Array, ‘GET’) #4 [internal function]: WP_Rest_Cache_Plugin\Includes\API\Endpoint_Api->save_cache(‘\n{“filterHtml”:…’) #5 /home/i/imstest1/imstest1.ru/public_html/wp-includes/class-wp-hook.php(310): call_user_func_array(Array, Array) #6 /home/i/imstest1/imstest1.ru/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(‘\n{“filterHtml”:…’, Array) #7 /home/i/imstest1/imstest1.ru/public_html/wp-includes/rest-api/class-wp-rest-server.php(517): apply_filters(‘rest_pre_echo_r…’, ‘\n{“filterHtml”:…’, Object(WP_REST_Server), Object(WP_REST_Request)) #8 /home/i/imstest1/imstest1.ru/public_html/wp-includes/rest-api.php(410): WP_REST_Server->serve_request(‘/wp/v2/composit…’) #9 [internal function]: rest_api_loaded(Object(WP)) #10 /home/i/imstest1/imstest1.ru/public_html/wp-includes/class-wp-hook.php(308): call_user_func_array(‘rest_api_loaded’, Array) #11 /home/i/imstest1/imstest1.ru/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array) #12 /home/i/imstest1/imstest1.ru/public_html/wp-includes/plugin.php(565): WP_Hook->do_action(Array) #13 /home/i/imstest1/imstest1.ru/public_html/wp-includes/class-wp.php(399): do_action_ref_array(‘parse_request’, Array) #14 /home/i/imstest1/imstest1.ru/public_html/wp-includes/class-wp.php(780): WP->parse_request(”) #15 /home/i/imstest1/imstest1.ru/public_html/wp-includes/functions.php(1334): WP->main(”) #16 /home/i/imstest1/imstest1.ru/public_html/wp-blog-header.php(16): wp() #17 /home/i/imstest1/imstest1.ru/public_html/index.php(17): require(‘/home/i/imstest…’) #18 {main} thrown in /home/i/imstest1/imstest1.ru/public_html/wp-content/plugins/wp-rest-cache/includes/caching/class-caching.php on line 936

    Thread Starter johnferz

    (@johnferz)

    Please help to fix.

    Thread Starter johnferz

    (@johnferz)

    Nothing in logs.

    Thread Starter johnferz

    (@johnferz)

    Also there are no entry of unknown cached objects.

    Thread Starter johnferz

    (@johnferz)

    Saving meta titles amd description solved.

    Database error is not solved.

    Thread Starter johnferz

    (@johnferz)

    Tried Yoast seo, works fine with titles and description on secondary languages. Rank Math don’t work. Why?

    Thread Starter johnferz

    (@johnferz)

    Disabling all plugins, except WPML plugins, and switching theme doesn’t solve this:

    1. Bulk editing titles and descriptions of pages do not work at all.
    Error 404 – el/wp-json/rankmath/v1/updateMetaBulk/
    NO REST ROUTE.
    2. We can’t save titles and descriptions of pages on secondary languages using snippet editor. After saving we see old titles and descriptions from yoast seo.

    So, if i understand correctly, there is no compatibility with WPML, isn’t it?

    Thread Starter johnferz

    (@johnferz)

    Thank you, but i see several problems:

    For example this:

    1. Bulk editing titles and descriptions of pages do not work at all.
    Error 404 – el/wp-json/rankmath/v1/updateMetaBulk/
    NO REST ROUTE.

    2. We can’t save titles and descriptions of pages on secondary languages using snippet editor. After saving we see old titles and descriptions from yoast seo.

    Thread Starter johnferz

    (@johnferz)

    mysqli

    MysqlI SupportenabledClient API library versionmysqlnd 7.4.33

    Thread Starter johnferz

    (@johnferz)

    When we try to recreate database tables we get this

    [16-Jul-2023 12:41:27 UTC] WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘COLLATE _bin NOT NULL,
    url_to text NOT NULL,
    header_code smallint(4) uns’ at line 3 for query CREATE TABLE wp_rank_math_redirections (
    id bigint(20) unsigned NOT NULL auto_increment,
    sources text CHARACTER SET COLLATE _bin NOT NULL,
    url_to text NOT NULL,
    header_code smallint(4) unsigned NOT NULL,
    hits bigint(20) unsigned NOT NULL default ‘0’,
    status varchar(25) NOT NULL default ‘active’,
    created datetime NOT NULL default ‘0000-00-00 00:00:00’,
    updated datetime NOT NULL default ‘0000-00-00 00:00:00’,
    last_accessed datetime NOT NULL default ‘0000-00-00 00:00:00’,
    PRIMARY KEY (id),
    KEY status (status)
    ) made by require(‘wp-blog-header.php’), wp, WP->main, WP->parse_request, do_action_ref_array(‘parse_request’), WP_Hook->do_action, WP_Hook->apply_filters, call_user_func_array, rest_api_loaded, WP_REST_Server->serve_request, WP_REST_Server->dispatch, WP_REST_Server->respond_to_request, call_user_func, RankMath\Rest\Admin->tools_actions, apply_filters(‘rank_math/tools/recreate_tables’), WP_Hook->apply_filters, call_user_func_array, RankMath\Tools\Database_Tools->recreate_tables, RankMath\Installer::create_tables, dbDelta

    Thread Starter johnferz

    (@johnferz)

    Also we have this error: WordPress database error Table ‘imstest1_gggtest.wp_rank_math_redirections_cache’ doesn’t exist

    We tried to recreate database tables using rankmath tools, but the problem still exists.

    Same error with simple fields like email.

    Thread Starter johnferz

    (@johnferz)

    Found also this

    1. Caching is working with default endpoints in wp/v2, works fine, quite fast, 50-100 ms.
    2. Caching is not working with custom endpoint in wp/v2

    https://abs.imservtest.ru/wp-json/wp/v2/products-ims

    function wprc_add_imserv_prod_posts_endpoint( $allowed_endpoints ) {
        if ( ! isset( $allowed_endpoints[ 'wp/v2' ] ) || ! in_array( 'products-ims', $allowed_endpoints[ 'wp/v2' ] ) ) {
            $allowed_endpoints[ 'wp/v2' ][] = 'products-ims';
        }
        return $allowed_endpoints;
    }
    add_filter( 'wp_rest_cache/allowed_endpoints', 'wprc_add_imserv_prod_posts_endpoint', 10, 1);
    
    function wprc_add_cacheable_request_headers( $cacheable_headers ) {
        $cacheable_headers['wp/v2/products-ims'] = 'authorization';
        return $cacheable_headers;
    }
    add_filter('wp_rest_cache/cacheable_request_headers', 'wprc_add_cacheable_request_headers', 10, 1);
    
    function wc_determine_object_type( $type, $cache_key, $data, $uri ) {
    	if ( '/wp-json/wp/v2/products-ims/categories' === substr( $uri, 0, 34 ) ) {
    		return 'product_cat';
    	} else if ( '/wp-json/wp/v2/products-ims' === substr( $uri, 0, 23 ) ) {
    		return 'product';
    	}
    
    	return $type;
    }
    add_filter( 'wp_rest_cache/determine_object_type', 'wc_determine_object_type', 10, 4 );
    
    function wc_flush_category_caches() {
    	\WP_REST_Cache_Plugin\Includes\Caching\Caching::get_instance()->delete_cache_by_endpoint( '/wp-json/wp/v2/products-ims/categories', \WP_REST_Cache_Plugin\Includes\Caching\Caching::FLUSH_LOOSE );
    }
    
    add_action( 'created_product_cat', 'wc_flush_category_caches', 10 );
    add_action( 'edit_product_cat', 'wc_flush_category_caches', 10 );
    add_action( 'delete_product_cat', 'wc_flush_category_caches', 10 );
    • This reply was modified 1 year, 11 months ago by johnferz.
    Thread Starter johnferz

    (@johnferz)

    mu file exists!

    Thread Starter johnferz

    (@johnferz)

    Changed route to https://abs.imservtest.ru/wp-json/wc/v3/products
    Plugin still doesn’t work.

    function wprc_add_imserv_prod_posts_endpoint( $allowed_endpoints ) {
        if ( ! isset( $allowed_endpoints[ 'wc/v3' ] ) || ! in_array( 'products', $allowed_endpoints[ 'wc/v3' ] ) ) {
            $allowed_endpoints[ 'wc/v3' ][] = 'products';
        }
        return $allowed_endpoints;
    }
    add_filter( 'wp_rest_cache/allowed_endpoints', 'wprc_add_imserv_prod_posts_endpoint', 10, 1);
    
    function wprc_add_cacheable_request_headers( $cacheable_headers ) {
        $cacheable_headers['wc/v3/products'] = 'authorization';
        return $cacheable_headers;
    }
    add_filter('wp_rest_cache/cacheable_request_headers', 'wprc_add_cacheable_request_headers', 10, 1);



Viewing 15 replies - 1 through 15 (of 22 total)