Title: docbt's Replies | WordPress.org

---

# docbt

  [  ](https://wordpress.org/support/users/docbt/)

 *   [Profile](https://wordpress.org/support/users/docbt/)
 *   [Topics Started](https://wordpress.org/support/users/docbt/topics/)
 *   [Replies Created](https://wordpress.org/support/users/docbt/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/docbt/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/docbt/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/docbt/engagements/)
 *   [Favorites](https://wordpress.org/support/users/docbt/favorites/)

 Search replies:

## Forum Replies Created

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

1 [2](https://wordpress.org/support/users/docbt/replies/page/2/?output_format=md)
[→](https://wordpress.org/support/users/docbt/replies/page/2/?output_format=md)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Elementor Website Builder - more than just a page builder] Bad Request (400) when editing multilingual page](https://wordpress.org/support/topic/bad-request-400-when-editing-multilingual-page/)
 *  Thread Starter [docbt](https://wordpress.org/support/users/docbt/)
 * (@docbt)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/bad-request-400-when-editing-multilingual-page/#post-13524798)
 * Hi guys!
    [@nicmare](https://wordpress.org/support/users/nicmare/): With a relative
   path some other plugins might break. For me Ultimate Member for example. So you
   should really use the second code I posted together with `define('WP_ADMIN_DIR','
   wp-admin');` in your wp-config.php
 * The CORS problem can be solved by adding the following code for all your domains
   to your functions.php
 *     ```
       function add_allowed_origins($origins) {
           $origins[] = 'https://www.domain.de';
           $origins[] = 'https://ja.domain.de';
           $origins[] = 'https://en.domain.de';        
           return $origins;
       }
       add_filter('allowed_http_origins', 'add_allowed_origins');
       ```
   
 * This way noone needs to install a browser plugin 😉
 * Your solution with the include style and script loader src is not relevant for
   me, cause I am using a static URL for all of my inlcudes/scripts/images/stylesheets(
   static.domain.de) anyway. This is good for the page speed and search engines (
   see cookie-free domain).
 * Here is my complete wp-config stuff for dynamic URLs with SSO (Single Sign On):
 *     ```
       $currentpath = preg_replace('@/+$@','',dirname($_SERVER['SCRIPT_NAME']));
       $currentpath = preg_replace('/\/wp.+/','',$currentpath);
       $protocol=$_SERVER['PROTOCOL'] = isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) ? 'https' : 'http';
       $currenthost = $protocol . "://".$_SERVER['HTTP_HOST'];
       define('WP_HOME',$currenthost.$currentpath);
       define('WP_SITEURL',$currenthost.$currentpath);
       define("WP_CONTENT_URL", "https://static.domain.de/wp-content"); 
       define('WP_PLUGIN_URL', 'https://static.domain.de/wp-content/plugins');
       //define('DOMAIN_CURRENT_SITE', $currenthost );
       define('COOKIE_DOMAIN', '.domain.de'); // Added by W3 Total Cache
       define('COOKIEPATH', '/');
       define('COOKIEHASH', '####Secret_Random_String###');
       //define('SITECOOKIEPATH', '/');
       define('AUTH_KEY', '####Secret_Random_String###);
       define('SECURE_AUTH_KEY', '####Secret_Random_String###');
       define('LOGGED_IN_KEY', '####Secret_Random_String###');
       define('AUTH_SALT', '####Secret_Random_String###');
       define('SECURE_AUTH_SALT', '####Secret_Random_String###');
       define('LOGGED_IN_SALT', '####Secret_Random_String###');
       ini_set('session.cookie_domain', '.domain.de');
   
       define('WP_ADMIN_DIR', 'wp-admin');
       ```
   
 * [@isuruxcode](https://wordpress.org/support/users/isuruxcode/)
    What did you 
   try already?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[wpForo Forum] Polylang missing date time translation](https://wordpress.org/support/topic/polylang-missing-date-time-translation/)
 *  Thread Starter [docbt](https://wordpress.org/support/users/docbt/)
 * (@docbt)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/polylang-missing-date-time-translation/#post-13512333)
 * After investigating the problem, it seems that the wordpress function human_time_diff()
   in formatting.php doens´t return translated strings (although the _n() function
   is called).
 * I tried to override the locale variable and added a text-domain, but that doesn
   ´t help, so I ended up in translating it in my themes functions manually.
 *     ```
       add_filter('human_time_diff', 'new_human_time_diff', 10, 2);
       function new_human_time_diff($from, $to) {
   
           // remove filter to prevent the loop
           remove_filter('human_time_diff', 'new_human_time_diff');
   
           $locale = get_locale();
   
           $timediff = human_time_diff($from, $to);
           if($locale == "en_US"){
               return $timediff;
            } else {
               $translate_from_plural = array("seconds", "mins", "days", "hours", "months", "weeks", "years");
               $translate_from_singular = array("second", "min", "day", "hour", "month", "week", "year");
               If ($locale == "de_DE"){
                   $translate_to_plural = array("Sekunden", "Minuten", "Tagen", "Stunden", "Monaten", "Wochen", "Jahren");
                   $translate_to_singluar = array("Sekunde", "Minute", "Tag", "Stunde", "Monat", "Woche", "Jahr");
               } elseif ($locale == "ja"){
                   $translate_to_plural = array("秒", "分", "日々", "時間", "月", "週", "年");
                   $translate_to_singluar = array("秒", "分", "日", "時間", "月", "週間", "年");
               }
               $timediff = str_replace($translate_from_singular,$translate_to_singluar,str_replace($translate_from_plural, $translate_to_plural, $timediff));
   
           }
           // restore the filter
           add_filter( 'human_time_diff', 'new_human_time_diff', 10, 2);     
   
           return $timediff;
       }
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Elementor Website Builder - more than just a page builder] Bad Request (400) when editing multilingual page](https://wordpress.org/support/topic/bad-request-400-when-editing-multilingual-page/)
 *  Thread Starter [docbt](https://wordpress.org/support/users/docbt/)
 * (@docbt)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/bad-request-400-when-editing-multilingual-page/#post-13506759)
 * The above code won´t work in sub-subpaths. So better use this one:
 *     ```
       function modify_adminy_url_for_ajax( $url, $path, $blog_id ) {
           if ( "admin-ajax.php" == $path ) {
               $url = home_url( '/' ) . WP_ADMIN_DIR . "/admin-ajax.php";
           }
           return $url;
       }
       add_filter("admin_url", "modify_adminy_url_for_ajax", 10, 3 );
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Elementor Website Builder - more than just a page builder] Bad Request (400) when editing multilingual page](https://wordpress.org/support/topic/bad-request-400-when-editing-multilingual-page/)
 *  Thread Starter [docbt](https://wordpress.org/support/users/docbt/)
 * (@docbt)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/bad-request-400-when-editing-multilingual-page/#post-13503639)
 * Ok, I solved it myself 😀 The solution is to change the URL of the admin-ajax.
   php to a relative path, instead of absolute.
 * Add this to your themes functions.php:
 *     ```
       function modify_adminy_url_for_ajax( $url, $path, $blog_id ) {
           if ( "admin-ajax.php" == $path ) {
               $url = "admin-ajax.php";
           }
           return $url;
       }
       add_filter("admin_url", "modify_adminy_url_for_ajax", 10, 3 );
       ```
   
 * And add all your domains to the allowe origins:
 *     ```
       add_filter('allowed_http_origins', 'add_allowed_origins');
       function add_allowed_origins($origins) {
           $origins[] = 'https://www.domain.de';
           $origins[] = 'https://ja.domain.de';
           $origins[] = 'https://en.domain.de';        
           return $origins;
       }
       ```
   
    -  This reply was modified 5 years, 8 months ago by [docbt](https://wordpress.org/support/users/docbt/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Converter for Media - Optimize images | Convert WebP & AVIF] Add custom folders](https://wordpress.org/support/topic/add-custom-folders/)
 *  Thread Starter [docbt](https://wordpress.org/support/users/docbt/)
 * (@docbt)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/add-custom-folders/page/2/#post-12997097)
 * I tested your new version and it workes perfect 😀👌
 * Everything got converted and I tested the WebP images successfully with chrome
   👍
 * Well done and thank you very much!
 * The only thing that might be better is, that new images will not be detected 
   automatically, if they are not uploaded to the media library.
 * Would be nice, if the plugin could detect plugin/theme changes and then suggest
   generating the files again (or do it automatically).
    Alternatively users might
   use your manual custom function in their themes functions and fire it on upload
   of images, if their plugins have an event/hook for that…
    -  This reply was modified 5 years, 11 months ago by [docbt](https://wordpress.org/support/users/docbt/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Converter for Media - Optimize images | Convert WebP & AVIF] Add custom folders](https://wordpress.org/support/topic/add-custom-folders/)
 *  Thread Starter [docbt](https://wordpress.org/support/users/docbt/)
 * (@docbt)
 * [5 years, 12 months ago](https://wordpress.org/support/topic/add-custom-folders/#post-12964934)
 * EDIT:
    I forgot the first line 😉
 * It works perfect for me.
 * Right know it runs everytime you open the admin dashboard. Would be better to
   run it only when the convert button is pressed.
 * Is there an existing hook?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Converter for Media - Optimize images | Convert WebP & AVIF] Add custom folders](https://wordpress.org/support/topic/add-custom-folders/)
 *  Thread Starter [docbt](https://wordpress.org/support/users/docbt/)
 * (@docbt)
 * [5 years, 12 months ago](https://wordpress.org/support/topic/add-custom-folders/#post-12964762)
 * I wrote a little custom function to generate the webp files manually for custom
   folders:
 *     ```
       add_action( 'admin_init', 'manual_webpc_convert_paths' );
       function manual_webpc_convert_paths() {  
           $testmode = false;
           $uploadpath = ABSPATH . "wp-content/uploads/";
       	// Custom folders in uploads
       	$custom_folders = array(
       		'ultimatemember/',
       		'wpdiscuz/'
           );  
           foreach ($custom_folders as $key => $custom_folder) {
               $paths = array();          
               $path = $uploadpath . $custom_folder;
               // Known linux problem with "." ".." in scandir()
               $folders = array_diff(scandir($path), array('..', '.'));
               foreach ($folders as $key => $folder) {
                   if(is_file($folder)){
                       $paths[] = $path . $folder;
                   } else {
                       // Known linux problem with "." ".." in scandir()
                       $subfolders[$folder] = array_diff(scandir($path . $folder), array('..', '.'));
                   }
               }
               foreach ($subfolders as $folder => $file) {
                   foreach ($file as $key => $filename) {
                       if(is_file($path . $folder . "/" . $filename)){
                           $paths[] = $path . $folder . "/" . $filename;
                       } else {
                           // Known linux problem with "." ".." in scandir()
                           $subsubfolders[$folder . "/" . $filename] = array_diff(scandir($path . $folder . "/" . $filename), array('..', '.'));
                       }
                   }
               }
               foreach ($subsubfolders as $folder => $file) {
                   foreach ($file as $key => $filename) {
                       if(is_file($path . $folder . "/" . $filename)){
                           $paths[] = $path . $folder . "/" . $filename;
                       }
                   }
               }                
               if($testmode){
                   //debug output in admin dashboard
                   echo '<pre>' . print_r($paths) . '</pre>';             
               } else {
                   // image checks are done in webpc 
                   do_action('webpc_convert_paths', $paths);
               }
               unset($paths);      
               unset($subfolders);
               unset($subsubfolders);
           }
       }
       ```
   
 * Goes to your theme -> functions.php
 * You can check the files first with $testmode = true in the first line. This will
   print the files in your admin dashboard instead of generating anything.
 * Add your custom folders in this section:
 *     ```
       	$custom_folders = array(
       		'ultimatemember/',
       		'wpdiscuz/'
           );  
       ```
   
    -  This reply was modified 5 years, 12 months ago by [docbt](https://wordpress.org/support/users/docbt/).
    -  This reply was modified 5 years, 12 months ago by [docbt](https://wordpress.org/support/users/docbt/).
      Reason: forgot the first line
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Converter for Media - Optimize images | Convert WebP & AVIF] Add custom folders](https://wordpress.org/support/topic/add-custom-folders/)
 *  Thread Starter [docbt](https://wordpress.org/support/users/docbt/)
 * (@docbt)
 * [6 years ago](https://wordpress.org/support/topic/add-custom-folders/#post-12955791)
 * The plugin is working. WebP images were created for all my image folders except
   ultimatemember and wpdiscuz.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Asset CleanUp: Page Speed Booster] Asset Cleanup with Autoptimize](https://wordpress.org/support/topic/asset-cleanup-with-autoptimize/)
 *  [docbt](https://wordpress.org/support/users/docbt/)
 * (@docbt)
 * [6 years ago](https://wordpress.org/support/topic/asset-cleanup-with-autoptimize/#post-12895427)
 * I could resolve the problem by activating minify/combine and enabling the debug
   option (only for Admin). After that I deativated minify/combine again.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Asset CleanUp: Page Speed Booster] Asset Cleanup with Autoptimize](https://wordpress.org/support/topic/asset-cleanup-with-autoptimize/)
 *  [docbt](https://wordpress.org/support/users/docbt/)
 * (@docbt)
 * [6 years ago](https://wordpress.org/support/topic/asset-cleanup-with-autoptimize/#post-12891377)
 * Hi [@gabelivan](https://wordpress.org/support/users/gabelivan/) !
 * I have the same problem.
 * I just want to use Asset cleanup to cleanup assets, cause I use antoher plugin
   to minify/cache…
 * I have deactivated css and js minification/combination/defer, but the plugin 
   still is generating cached versions.
 * I reinstalled the plugin reset all my settings, but nothing helps. I can´t disable
   the features.
 * ![](https://i0.wp.com/i.ibb.co/qMqH4kt/Anmerkung-2020-05-26-091200.jpg?ssl=1)
    -  This reply was modified 6 years ago by [docbt](https://wordpress.org/support/users/docbt/).
    -  This reply was modified 6 years ago by [docbt](https://wordpress.org/support/users/docbt/).
    -  This reply was modified 6 years ago by [docbt](https://wordpress.org/support/users/docbt/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[wpForo Forum] security lack with ultimate member profil](https://wordpress.org/support/topic/security-lack-with-ultimate-member-profil/)
 *  Thread Starter [docbt](https://wordpress.org/support/users/docbt/)
 * (@docbt)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/security-lack-with-ultimate-member-profil/#post-12400964)
 * Finally fixed! Thank you 🙂
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Ultimate Member – User Profile, Registration, Login, Member Directory, Content Restriction & Membership Plugin] all cover photos have 300px width](https://wordpress.org/support/topic/all-cover-photos-have-300px-width/)
 *  Thread Starter [docbt](https://wordpress.org/support/users/docbt/)
 * (@docbt)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/all-cover-photos-have-300px-width/#post-12227621)
 * It works, if I delete all generated thumbnails manually from the upload directory
   👍
 * Is it possible to deactivate the thumbnail generation on upload?
 * If I delete all upload thumbnail sizes and click on save, it doesn´t save…
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Ultimate Member – User Profile, Registration, Login, Member Directory, Content Restriction & Membership Plugin] all cover photos have 300px width](https://wordpress.org/support/topic/all-cover-photos-have-300px-width/)
 *  Thread Starter [docbt](https://wordpress.org/support/users/docbt/)
 * (@docbt)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/all-cover-photos-have-300px-width/#post-12227533)
 * 2 upload cover thumbnail sizes are set 300px and 600px.
 * Minimum and maximum cover widths are set to 822px.
 * On my tablet and smartphone I see the 300px version of the cover…
 * `<img src="/wp-content/uploads/ultimatemember/1/cover_photo-300.jpg" alt="" /
   >`
 * I deleted the 300px thumbnail upload size for testing and still see the 300px
   version.
 * ![Unbenannt](https://i0.wp.com/i.ibb.co/PNMfGYh/Unbenannt.jpg?ssl=1)
 * ![Unbenannt2](https://i0.wp.com/i.ibb.co/1zsCRmG/Unbenannt2.jpg?ssl=1)
    -  This reply was modified 6 years, 6 months ago by [docbt](https://wordpress.org/support/users/docbt/).
    -  This reply was modified 6 years, 6 months ago by [docbt](https://wordpress.org/support/users/docbt/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Ultimate Member – User Profile, Registration, Login, Member Directory, Content Restriction & Membership Plugin] all cover photos have 300px width](https://wordpress.org/support/topic/all-cover-photos-have-300px-width/)
 *  Thread Starter [docbt](https://wordpress.org/support/users/docbt/)
 * (@docbt)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/all-cover-photos-have-300px-width/#post-12226307)
 * Hi [@champsupertramp](https://wordpress.org/support/users/champsupertramp/),
 * thanks. I changed the values for profile and cover sizes to “original size” and
   it workes for the desktop version.
 * But on mobile devices I still see the thumbnails for the covers and the quality
   is poor…
 * Is there a way to disable the mobile versions completely?
    Shouldn´t it be original
   size with my settings?
 * Greetings,
    doc
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[wpForo Forum] security lack with ultimate member profil](https://wordpress.org/support/topic/security-lack-with-ultimate-member-profil/)
 *  Thread Starter [docbt](https://wordpress.org/support/users/docbt/)
 * (@docbt)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/security-lack-with-ultimate-member-profil/#post-12226228)
 * Hi,
    the problem is still present. I changed the status back to “not resolved”.
   Greetings doc

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

1 [2](https://wordpress.org/support/users/docbt/replies/page/2/?output_format=md)
[→](https://wordpress.org/support/users/docbt/replies/page/2/?output_format=md)