• Looks like this plugin is no longer maintained based on issues and update history. If you face issues preventing to render your theme’s frontpage and your theme is using Kirki, check if the fonts are correctly downloaded by the Kirky framework to a local fonts folder. As a temporarily fix, you might consider to switch FS_METHOD to direct. However, if your WordPress instance requires FTP credentials, you might want to check the following patch, which alters direct filesystem access by using wp_filesystem methods instead.

    What does the patch do:

    1. Added request_filesystem_credentials method and supplied it to initiate a proper WP_Filesystem, which is mandatory to get FTP connection working.
    2. Replace any local file_exists checks by wp_filesystem->exists methods
    3. Replace use of constant WP_CONTENT_DIR by wp_content_dir() method provided by the specific wp_filesystem class.
    4. Replace move of files by appropriate puts_content method of the wp_filesystem class
    --- kirki/kirki-packages/module-webfonts/src/Webfonts/Downloader.php.org        2025-09-19 11:32:09.410422508 +0200
    +++ kirki/kirki-packages/module-webfonts/src/Webfonts/Downloader.php 2025-09-19 14:10:48.881643038 +0200
    @@ -68,18 +68,19 @@
    $stored = get_option( 'kirki_downloaded_font_files', array() );
    $change = false; // If in the end this is true, we need to update the cache option.

    + $fonts_base_path = $this->get_filesystem()->wp_content_dir() . 'fonts/';
    // If the fonts folder don't exist, create it.
    - if ( ! file_exists( WP_CONTENT_DIR . '/fonts' ) ) {
    - $this->get_filesystem()->mkdir( WP_CONTENT_DIR . '/fonts', FS_CHMOD_DIR );
    + if ( ! $this->get_filesystem()->exists( $fonts_base_path )) {
    + $this->get_filesystem()->mkdir( $fonts_base_path, FS_CHMOD_DIR );
    }

    foreach ( $font_files as $font_family => $files ) {

    // The folder path for this font-family.
    - $folder_path = WP_CONTENT_DIR . '/fonts/' . $font_family;
    + $folder_path = $fonts_base_path . $font_family;

    // If the folder doesn't exist, create it.
    - if ( ! file_exists( $folder_path ) ) {
    + if ( ! $this->get_filesystem()->exists( $folder_path ) ) {
    $this->get_filesystem()->mkdir( $folder_path, FS_CHMOD_DIR );
    }

    @@ -89,7 +90,7 @@
    $filename = basename( wp_parse_url( $url, PHP_URL_PATH ) );
    $font_path = $folder_path . '/' . $filename;

    - if ( file_exists( $font_path ) ) {
    + if ( $this->get_filesystem()->exists( $font_path ) ) {

    // Skip if already cached.
    if ( isset( $stored[ $url ] ) ) {
    @@ -106,6 +107,7 @@

    // Download file to temporary location.
    $tmp_path = download_url( $url );
    + $file_content = file_get_contents($tmp_path);

    // Make sure there were no errors.
    if ( is_wp_error( $tmp_path ) ) {
    @@ -113,11 +115,12 @@
    }

    // Move temp file to final destination.
    - $success = $this->get_filesystem()->move( $tmp_path, $font_path, true );
    + $success = $this->get_filesystem()->put_contents( $font_path, $file_content );
    if ( $success ) {
    $stored[ $url ] = $font_path;
    $change = true;
    }
    + unlink($tmp_path);
    }
    }

    @@ -278,11 +281,17 @@
    */
    protected function get_filesystem() {
    global $wp_filesystem;
    +
    if ( ! $wp_filesystem ) {
    if ( ! function_exists( 'WP_Filesystem' ) ) {
    require_once wp_normalize_path( ABSPATH . '/wp-admin/includes/file.php' );
    }
    - WP_Filesystem();
    + // retrieve credentials
    + if (false === ($creds = request_filesystem_credentials('.'))) {
    + // no credentials, no access to wp_filesystem
    + return false;
    + }
    + WP_Filesystem($creds);
    }
    return $wp_filesystem;
    }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.