Forum Replies Created

Viewing 15 replies - 1 through 15 (of 26 total)
  • Thread Starter Alex Kozack

    (@cawa-93)

    This is a custom table created like so:

    dbDelta(
    "CREATE TABLE {$table} (
    id bigint(9) UNSIGNED NOT NULL AUTO_INCREMENT,
    view_date date DEFAULT (UTC_DATE) NOT NULL,
    partner_id bigint(9) UNSIGNED DEFAULT NULL,
    channel_id bigint(9) UNSIGNED NOT NULL,
    style_id bigint(9) UNSIGNED NOT NULL,
    landing_query bigint(9) UNSIGNED DEFAULT NULL,
    custom_id bigint(9) UNSIGNED DEFAULT NULL,
    search_query bigint(9) UNSIGNED NOT NULL,
    terms varchar(255) DEFAULT NULL,
    view_count bigint(9) UNSIGNED DEFAULT 1,
    unique_hash VARCHAR(40) GENERATED ALWAYS AS (SHA1(CONCAT(view_date, partner_id, channel_id, style_id, coalesce(landing_query,0), coalesce(custom_id,0), coalesce(search_query,0), coalesce(terms,0)))) STORED,
    PRIMARY KEY (id),
    UNIQUE INDEX unique_view_segment (unique_hash)
    ) $charsetCollate;",
    );

    According to

    You should avoid setting loading=lazy for any images that are in the first visible viewport

    web.dev

    it feels logical to me to disable lazy loading for some cases. For example, in our design, the first thumbnail of an article is guaranteed to be loaded in the viewport. So I tried to somehow disable lazy loading for this specific place but leave it in other places and leave the conversion to webp

    Ok. Can I at least get “Picture WebP Rewriting” without lazy loading? I need webp and lazy loading for all images except 1 single LCP image in articles. I added the “data-skip-lazy” attribute to that images but with lazy-loading it also disabled Picture WebP Rewriting

    • This reply was modified 10 months, 3 weeks ago by Alex Kozack.
    Thread Starter Alex Kozack

    (@cawa-93)

    More digging and I came to the conclusion that the problem was that my category was missing from the wp_yoast_indexable table. I updated its title, and it was added to this table, after which the problem disappeared.

    I had to update all my categories in a same way.

    Thread Starter Alex Kozack

    (@cawa-93)

    It took a bit more digging, but I managed to find out that \Yoast\WP\SEO\Builders\Indexable_Hierarchy_Builder::save_ancestors is a problem.

    It gets $indexable And $indexable->ancestors is

    array(1) {
      [0]=>
      object(Yoast\WP\SEO\Models\Indexable)#2443 (34) {
        ["object_type"]=>
        string(4) "term"
        ["object_id"]=>
        string(1) "1"
        ["object_sub_type"]=>
        string(8) "category"
        ["permalink"]=>
        string(49) "https://dailyadvisor.local/category/uncategorized/"
        ["blog_id"]=>
        string(1) "1"
        ["primary_focus_keyword_score"]=>
        NULL
        ["is_robots_noindex"]=>
        NULL
        ["is_public"]=>
        NULL
        ["open_graph_image"]=>
        NULL
        ["open_graph_image_id"]=>
        NULL
        ["open_graph_image_source"]=>
        NULL
        ["open_graph_image_meta"]=>
        NULL
        ["twitter_image"]=>
        NULL
        ["twitter_image_id"]=>
        NULL
        ["twitter_image_source"]=>
        NULL
        ["canonical"]=>
        NULL
        ["primary_focus_keyword"]=>
        NULL
        ["title"]=>
        NULL
        ["description"]=>
        NULL
        ["readability_score"]=>
        NULL
        ["inclusive_language_score"]=>
        NULL
        ["breadcrumb_title"]=>
        string(13) "Uncategorized"
        ["open_graph_title"]=>
        NULL
        ["open_graph_description"]=>
        NULL
        ["twitter_title"]=>
        NULL
        ["twitter_description"]=>
        NULL
        ["is_cornerstone"]=>
        string(1) "0"
        ["is_robots_nofollow"]=>
        NULL
        ["is_robots_noarchive"]=>
        NULL
        ["is_robots_noimageindex"]=>
        NULL
        ["is_robots_nosnippet"]=>
        NULL
        ["object_published_at"]=>
        string(19) "2023-10-01 00:04:29"
        ["object_last_modified"]=>
        string(19) "2023-12-18 14:32:09"
        ["version"]=>
        string(1) "2"
      }
    }

    Then it call

    foreach ( $indexable->ancestors as $ancestor ) {
      $this->indexable_hierarchy_repository->add_ancestor( $indexable->id, $ancestor->id, $depth );
    }

    But $ancestor->id in not defined only $ancestor->object_id exist

    I also get this error on one of my sites. But I don’t get on others. As you mentioned, this error disappeared after a few minutes.

    Thread Starter Alex Kozack

    (@cawa-93)

    Actually, I need it to programmatically create post content. I have a text. I have a uploaded image, have it ID. I need to combine them and create a post. All of this should happen programmatically in the our corporate utility.

    Before WordPress v5 it was real. I used description.renderer in attachment data and insert into the post.

    I can still do that. However, to make it easier for our employees, the final text must be saved as gutenberg-blocks.

    I need at least some way to get the html block code by its name and attributes. Anyone, on the server or on the client.

    As I would do it manually, in a visual editor – I chose a block, inserted the necessary parameters into it. But programmatically.

    Thread Starter Alex Kozack

    (@cawa-93)

    You are right. However, I wanted to say that if you use single quotes, in the absence of a semicolon, the plugin adds a break to a new line. So the code remains valid. And when using template literals this does not happen.

    Thread Starter Alex Kozack

    (@cawa-93)

    Sadly. This is not a good fit for me, since there are files that are no longer needed. The browser will still load them.

    I think that I could use the method, from the example below. However, I’m not very sure how this will affect the performance of the web server.

    
    add_filter( 'autoptimize_html_after_minify', function ( $content ) {
    	$doc = new DOMDocument();
    	$doc->loadHTML( $content );
    
    	$str = '';
    
    	foreach ( $doc->getElementsByTagName( 'script' ) as $script ) {
    		$src = $script->getAttribute( 'src' );
    		if ( ! empty( $src ) ) {
    			$str .= "<link rel='preload' as='script' href='{$script->getAttribute( 'src' )}'>\n";
    		}
    	}
    	
    	return str_replace( '<!--preload_scripts_placement-->', $str, $content );
    } )
    
    Thread Starter Alex Kozack

    (@cawa-93)

    I can create Pull request if you tell me where I can do that

    /wp-json/wp/v2/users/me

    /wp-json/wp/v2/users/me

    Thread Starter Alex Kozack

    (@cawa-93)

    No, if use this code, there are no errors and the plugin successfully creates and inserts the minified files

    Thread Starter Alex Kozack

    (@cawa-93)

    JS code
    console.log(`Some " text`) // doesn't work

    From php error log

    [06 - Nov - 2018 13: 40: 03 UTC] PHP Fatal error: Uncaught JSMin_UnterminatedStringException: JSMin: Unterminated String at byte 129: " text`
    )  // doesn't work in /app/pu`blic/wp-content/plugins/autoptimize/classes/external/php/jsmin.php:211
    Stack trace:
    #0 / app / public / wp - content / plugins / autoptimize / classes / external / php / jsmin.php(152): JSMin -& gt; action(2)
    #1 / app / public / wp - content / plugins / autoptimize / classes / external / php / jsmin.php(86): JSMin -& gt; min()
    #2 / app / public / wp - content / plugins / autoptimize / classes / autoptimizeSpeedupper.php(38): JSMin:: minify('try{// @ts-noch...')
    #3 / app / public / wp - includes / class- wp - hook.php(286): autoptimizeSpeedupper -& gt; js_snippetcacher('try{// @ts-noch...', '/app/public/wp-...')
    #4 / app / public / wp - includes / plugin.php(203): WP_Hook -& gt; apply_filters('try{// @ts-noch...', Array)
    #5 / app / public / wp - content / plugins / autoptimize / classes / autoptimizeScripts.php(318): apply_filters('autoptimize_js_...', 'try{// @ts-noch...', '/app/public/wp-...')
    #6 / app / public / wp - content / plugins / autoptimize / classes / autoptimizeMain.php(448): autoptimizeScripts -& gt; minify()
    # in /app/public / wp - content / plugins / autoptimize / classes / external / php / jsmin.php on line 211
    Thread Starter Alex Kozack

    (@cawa-93)

    @alessandrotesoro, Thanks. I did not find information about this in the description of the add-on

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