• When using plugin on wp site wrapped with WP Bedrock the plugin takes
    site_url() and WP Bedrock in .env file requires this structure WP_SITEURL=${WP_HOME}/wp

    This means that the plugin saves under https://www.example.com/wp/file.xml
    I don’t want to expose my /wp dir to public

    First of all can you please add field where I can specify where to save the .xml?

    • This topic was modified 4 years, 11 months ago by Elvis Rauza.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Omar AlDabbas

    (@omardabbas)

    Hello @elvisrauzawork,

    Sorry for the late reply, didn’t have a chance to check the forum here recenlty.

    Yes you can change this setting by changing the option “XML file path and name” that you can find in the plugin “General Options”, you can change it to something like:
    wp-content/uploads/products.xml

    Please let me know if this is not what you’re looking for.

    Omar

    Thread Starter Elvis Rauza

    (@elvisrauzawork)

    Hello @omardabbas,

    If I change it to wp-content/uploads/products then the path becomes:
    https://www.sitename.lv/wp/wp-content/uploads/products.xml
    But I don’t want /wp/ in my file path, as mentioned before.

    So the problem is that plugin takes this site_url() as base for path.
    You could use this get_home_url()
    As mentioned in here – https://developer.www.ads-software.com/reference/functions/get_home_url/

    Retrieves the URL for a given site where the front end is accessible.

    Sincerely,
    Elvis.

    Plugin Author Omar AlDabbas

    (@omardabbas)

    Sorry for this edit, I’m doing more tests on the development version to have it implemented without affecting current users.

    Will keep you posted.
    Omar

    Thread Starter Elvis Rauza

    (@elvisrauzawork)

    Waiting for update!
    Elvis.

    Plugin Author Omar AlDabbas

    (@omardabbas)

    Hello @elvisrauzawork,

    Sorry it took a bit longer that expected, but as promised, I’ve updated the plugin with an option to allow saving the file on home_url().

    Please check the latest release and let me know if you have any question.

    P.S. If you found the plugin & support useful, it will be highly appreciated to leave us a review.

    Omar

    Thread Starter Elvis Rauza

    (@elvisrauzawork)

    Hello @omardabbas

    Sorry for late response.

    I have suggestion on feed settings to show correct URL.
    Now when I chose “Use Site Address (HOME_URL)” it doesn’t represent on “XML file path and name” URL field.
    Also is writable doesn’t work correctly it returns site_url() independently of “Use Site Address (HOME_URL)” option.
    This code in class-alg-wc-product-xml-feeds-settings-feed.php fixes both problems.

    
    if ( 'yes' == $use_home_url ) {
        $feed_path = get_home_path();
        $feed_url = home_url() . '/' . get_option( 'alg_products_xml_file_path_' . $this->feed_num, $default_file_name );
    } else {
        $feed_path = ABSPATH;
        $feed_url = site_url() . '/' . get_option( 'alg_products_xml_file_path_' . $this->feed_num, $default_file_name );
    }
    }
    

    and

    
    'desc'     => __( 'URL:', 'product-xml-feeds-for-woocommerce' ) . ' ' . '<a target="_blank" href="' . $feed_url . '">' . $feed_url . '</a>',
    

    Also, file doesn’t save, after amending class-alg-wc-product-xml-feeds-core file to

    
    // Create XML feed file
    if ( 'yes' == get_option( 'alg_products_xml_use_home_url_' . $file_num, 'no' ) ) {
        $new_path = get_home_path();
    } else {
        $new_path = ABSPATH;
    }
    
    return file_put_contents(
        $new_path . get_option( 'alg_products_xml_file_path_' . $file_num, ( ( 1 == $file_num ) ? 'products.xml' : 'products_' . $file_num . '.xml' ) ),
        do_shortcode( $xml_header_template ) . $xml_items . do_shortcode( $xml_footer_template )
    );
    

    file does save to correct location

    Thread Starter Elvis Rauza

    (@elvisrauzawork)

    Hello @omardabbas
    The issue still is there.
    Plugin doesn’t save to home_url

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘On WP Bedrock saves in /wp dir’ is closed to new replies.