Title: [Plugin: WordPress HTTPS] XML-Sitemap Generator hack
Last modified: August 19, 2016

---

# [Plugin: WordPress HTTPS] XML-Sitemap Generator hack

 *  Resolved [Richard Vencu](https://wordpress.org/support/users/rvencu/)
 * (@rvencu)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/plugin-wordpress-https-xml-sitemap-generator-hack/)
 * Hi, In order to generare a good XML sitemap using [XML-Sitemap Generator](http://wordpress.org/extend/plugins/google-sitemap-generator/)
   in conjunction with this plugin I hacked the sitemap-core.php and injected this
   code starting line 1850 by replacing
 *     ```
       $GLOBALS['post'] = &$post;
       $permalink = get_permalink($post->ID);
       ```
   
 * with
 *     ```
       $GLOBALS['post'] = &$post;
       $permalink = get_permalink($post->ID);
   
       //check for force_ssl custom field - hack
       $force_ssl  = get_post_meta($post->ID, 'force_ssl');
       // Is it empty?
       if($force_ssl) {
       $permalink = str_replace('http:', 'https:', $permalink);
       }
       else {
       $permalink = str_replace('https:', 'http:', $permalink);
       }
       //end of hack
       ```
   

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Thread Starter [Richard Vencu](https://wordpress.org/support/users/rvencu/)
 * (@rvencu)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/plugin-wordpress-https-xml-sitemap-generator-hack/#post-1767614)
 * I would like to see a similar thing in the WP custom menus I am using so there
   would be no more redirects from http to https into those pages
 *  Plugin Author [mvied](https://wordpress.org/support/users/mvied/)
 * (@mvied)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-wordpress-https-xml-sitemap-generator-hack/#post-1767735)
 * You should be able to accomplish this with the ‘Disable Automatic HTTPS’ setting
   in WordPress HTTPS. I know it works on custom menus, so I’m assuming you don’t
   have that option on.
 * Let me know if that fixes it for you.
 *  Thread Starter [Richard Vencu](https://wordpress.org/support/users/rvencu/)
 * (@rvencu)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-wordpress-https-xml-sitemap-generator-hack/#post-1767736)
 * Yes, it works as intended. However what I wanted to say is that I need menus 
   to point me to a mixed load of http and https links. Now they all point to the
   http then the http page loads, then it is redirected to https page.
 * If the server is severely loaded then the redirect is taking few seconds and 
   the final page is displayed very slow. Therefore I thought maybe there is a way
   to construct the menu directly with proper http and https links according to 
   the force_ssl custom field.
 *  Plugin Author [mvied](https://wordpress.org/support/users/mvied/)
 * (@mvied)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-wordpress-https-xml-sitemap-generator-hack/#post-1767742)
 * Ah, I see what you mean. That would be ideal, but not as simple as it sounds.
   🙂
 * This is definitely something I want to add to the plugin at some point, but I
   can’t see me fitting it in there any time soon.
 * It is worth noting that HTTPS is significantly slower than HTTP due to encryption
   and such, and that may be what you’re experiencing.
 *  Thread Starter [Richard Vencu](https://wordpress.org/support/users/rvencu/)
 * (@rvencu)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-wordpress-https-xml-sitemap-generator-hack/#post-1767749)
 * True, however I am looking at Chrome Developer Tools in Resource Section, Time
   and I can see:
    – load of HTTP page and decision to redirect – 1.02s – load of
   HTTPS page (from cache – is true) – 65ms – load of other elements – 0.25s – DOMContent
   event fired – 1.36s – Load event fired – 1.48s
 * So when the cache is involved, the redirection takes most of the time. At this
   speed there is no problem but if the reader is across continents the latency 
   will just double and the page tends to become very slow.
 * If I get any idea how to do it I will let you know.
 * Cheers
 *  Plugin Author [mvied](https://wordpress.org/support/users/mvied/)
 * (@mvied)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-wordpress-https-xml-sitemap-generator-hack/#post-1767791)
 * Hey rvencu,
 * I just wanted to let you know that I’ve figured out a relatively easy way to 
   avoid all the redirections. I’ll get it into the next version, which I should
   be able to push out before this weekend.
 * Thanks,
    Mike
 *  Thread Starter [Richard Vencu](https://wordpress.org/support/users/rvencu/)
 * (@rvencu)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-wordpress-https-xml-sitemap-generator-hack/#post-1767793)
 * Hi [@mvied](https://wordpress.org/support/users/mvied/), I updated the plugin
   and it is working very well. If I catch any error I will notify you ASAP.
 * Great solution!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘[Plugin: WordPress HTTPS] XML-Sitemap Generator hack’ is closed to new
replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wordpress-https_bec2c9.svg)
 * [WordPress HTTPS (SSL)](https://wordpress.org/plugins/wordpress-https/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-https/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-https/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-https/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-https/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-https/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [Richard Vencu](https://wordpress.org/support/users/rvencu/)
 * Last activity: [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-wordpress-https-xml-sitemap-generator-hack/#post-1767793)
 * Status: resolved