Title: Ryan's Replies | WordPress.org

---

# Ryan

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

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

 Search replies:

## Forum Replies Created

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

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

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP Hashed IDs] Undefined Index (notice) hashed_id](https://wordpress.org/support/topic/undefined-index-notice-hashed_id/)
 *  [Ryan](https://wordpress.org/support/users/ryanmclaughlin1/)
 * (@ryanmclaughlin1)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/undefined-index-notice-hashed_id/#post-9086133)
 * Better to return early without any changes to avoid overwriting pagename…
 *     ```
       function _hashed_id_parse_request($qv) {
           if ( ! isset( $qv->query_vars['hashed_id'] ) ) {
               return $qv;
           }
   
           // ...
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP Hashed IDs] Use of undefined constant alpha_length – assumed ‘alpha_length’](https://wordpress.org/support/topic/use-of-undefined-constant-alpha_length-assumed-alpha_length/)
 *  [Ryan](https://wordpress.org/support/users/ryanmclaughlin1/)
 * (@ryanmclaughlin1)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/use-of-undefined-constant-alpha_length-assumed-alpha_length/#post-9086120)
 * It is line 45 for me…
 * Short term fix:
 * Look in `wp-content/plugins/wp-hashed-ids/wp-hashed-ids.php` for the following
   line:
 * `$alphabet = (alpha_length >= $min_length || alpha_length < 16) ? $options['wp_hashed_ids_alphabet']:'';`
 * And change both occurrences of `alpha_length` to `$alpha_length`.
 * Just keep in mind any plugin updates will overwrite your changes.
 *   Forum: [Themes and Templates](https://wordpress.org/support/forum/themes-and-templates/)
   
   In reply to: [[Hew] Ellipsis icon broken, v1.0.2](https://wordpress.org/support/topic/ellipsis-icon-broken-v102/)
 *  Thread Starter [Ryan](https://wordpress.org/support/users/ryanmclaughlin1/)
 * (@ryanmclaughlin1)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/ellipsis-icon-broken-v102/#post-6789300)
 * Thanks Kathryn. I will keep an eye out for the next update!
 *   Forum: [Themes and Templates](https://wordpress.org/support/forum/themes-and-templates/)
   
   In reply to: [[Hew] Ellipsis icon broken, v1.0.2](https://wordpress.org/support/topic/ellipsis-icon-broken-v102/)
 *  Thread Starter [Ryan](https://wordpress.org/support/users/ryanmclaughlin1/)
 * (@ryanmclaughlin1)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/ellipsis-icon-broken-v102/#post-6789275)
 * Hey kathryn – yes, that is the icon i am talking about. That is very strange 
   that it is working fine for you.
 * I am working a local dev site so I don’t have a link to share at the moment.
 * I did notice that the wp.org theme preview seems to be having the same problem,
   but the wp.com theme demo does not.
 * Here is a gallery of everything i am seeing for reference: [http://imgur.com/a/0i4l8](http://imgur.com/a/0i4l8)
 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [About sanitizing hex color [sanitize_hex_color]](https://wordpress.org/support/topic/about-sanitizing-hex-color-sanitize_hex_color/)
 *  [Ryan](https://wordpress.org/support/users/ryanmclaughlin1/)
 * (@ryanmclaughlin1)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/about-sanitizing-hex-color-sanitize_hex_color/#post-6133535)
 * Yes you are absolutely right. I made some assumptions about load order in my 
   first response but after taking a closer look class-wp-customize-manager.php 
   isn’t included until the plugins_loaded hook. I will edit my previous to reflect
   this.
 * edit: i guess i can’t edit old posts, so nevermind.
 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [get_avatar() returns an url with #038; instead of &](https://wordpress.org/support/topic/get_avatar-returns-an-url-with-038-instead-of/)
 *  [Ryan](https://wordpress.org/support/users/ryanmclaughlin1/)
 * (@ryanmclaughlin1)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/get_avatar-returns-an-url-with-038-instead-of/#post-6133042)
 * Hi giu1io – it looks like they did make some modifications to get_avatar in order
   to add the srcset attribute in 4.2.
 * Additionally, in 4.1 they were using str_replace to swap out **& # 0 3 8 ;** 
   with **& a m p ;**. They are no longer doing so.
 * The reason the srcset and src values are different is that one is being escaped
   with the esc_url() function and the other is being escaped with the esc_attr()
   function. Both are technically correct.
 * **& # 0 3 8 ;** and **& a m p ;** are just different references to the same character…
   you should be able to use them interchangeably.
 * Do you have a specific case in mind where the url with **& # 0 3 8 ;** is not
   working correctly?
 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [Sidebar Custom Menu Widget Hacked & Won't Work on Sidebar](https://wordpress.org/support/topic/sidebar-custom-menu-widget-hacked-wont-work-on-sidebar/)
 *  [Ryan](https://wordpress.org/support/users/ryanmclaughlin1/)
 * (@ryanmclaughlin1)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/sidebar-custom-menu-widget-hacked-wont-work-on-sidebar/#post-6134516)
 * By default, the custom menu widget prompts you for a title and to select a menu.
   This is normal, your widget has not been hacked.
 * You can create a new menu under appearance>menus and put any sort of links you
   want in it, give it a name, and then it will show up in the list of menus available
   to your widget.
 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [About sanitizing hex color [sanitize_hex_color]](https://wordpress.org/support/topic/about-sanitizing-hex-color-sanitize_hex_color/)
 *  [Ryan](https://wordpress.org/support/users/ryanmclaughlin1/)
 * (@ryanmclaughlin1)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/about-sanitizing-hex-color-sanitize_hex_color/#post-6133527)
 * Nilambar –
 * I imagine this function is kept there because it is probably only used in core
   by the customizer.
 * And the reason it is saying function not found is that this file is not included
   with every page request – only when you are actually in the customizer.
 * The actual function is small and simple, so an easy fix would be to duplicate
   it in your theme/plugin wrapped in a function_exists check. This way it will 
   always be available to you.
 * So like this:
 *     ```
       if ( ! function_exists( 'sanitize_hex_color' ) ) {
           function sanitize_hex_color( $color ) {
               if ( '' === $color )
                   return '';
   
               // 3 or 6 hex digits, or the empty string.
               if ( preg_match('|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) )
                   return $color;
   
               return null;
           }
       }
       ```
   
 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [How to assign a Page Template to certain URL Patterns?](https://wordpress.org/support/topic/how-to-assign-a-page-template-to-certain-url-patterns/)
 *  [Ryan](https://wordpress.org/support/users/ryanmclaughlin1/)
 * (@ryanmclaughlin1)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/how-to-assign-a-page-template-to-certain-url-patterns/#post-5010432)
 * This may be worth a read:
 * > [Rewrite endpoints API](https://make.wordpress.org/plugins/2012/06/07/rewrite-endpoints-api/)
 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [Is loading wp-load.php and admin.php in your popup acceptable?](https://wordpress.org/support/topic/is-loading-wp-loadphp-and-adminphp-in-your-popup-acceptable/)
 *  [Ryan](https://wordpress.org/support/users/ryanmclaughlin1/)
 * (@ryanmclaughlin1)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/is-loading-wp-loadphp-and-adminphp-in-your-popup-acceptable/#post-6112752)
 * you might find this article helpful: [http://ottopress.com/2010/dont-include-wp-load-please/](http://ottopress.com/2010/dont-include-wp-load-please/)
 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [Don't trim space at the end](https://wordpress.org/support/topic/dont-trim-space-at-the-end/)
 *  [Ryan](https://wordpress.org/support/users/ryanmclaughlin1/)
 * (@ryanmclaughlin1)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/dont-trim-space-at-the-end/#post-6098217)
 * ok i think i understand better now.
 * mndewitt: that was my original thought as well, but the problem is that when 
   you are saving the option, the post data is trimmed directly before it is passed
   to update_option which in turn passes it to the sanitize callback. so the spaces
   will have already been removed by the time the callback runs. in fact, the callback
   is run on the same sanitize_option_{option-name} filter i mentioned previously.
 * chris: another option to consider would be to hook in much earlier in the wp-
   admin startup process, verify that you are on options.php, that you are updating
   and check for your setting at $_POST[‘option-name’]. if it is set, then you can
   modify it directly, maybe surrounding it with quotes like mndewitt suggests or
   maybe replacing spaces with some sort of token such as %%SPACE%%.
 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [Don't trim space at the end](https://wordpress.org/support/topic/dont-trim-space-at-the-end/)
 *  [Ryan](https://wordpress.org/support/users/ryanmclaughlin1/)
 * (@ryanmclaughlin1)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/dont-trim-space-at-the-end/#post-6098198)
 * Hey chris – i am not overly familiar with the setting api but from a quick look
   it seems as though options.php trims the option value before updating it, which
   means you _may_ be out of luck.
 * however you might be able to find a workaround – for example if the value is 
   an array, it isn’t trimmed. or alternatively there are at least a couple of filters
   on the value after it has been trimmed but before it is saved such as pre_update_option_{
   option-name} and sanitize_option_{option-name}.
 * hopefully this gives you some ideas on how to proceed.
 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [Adding a search results page to your site like an RSS feed](https://wordpress.org/support/topic/adding-a-search-results-page-to-your-site-like-an-rss-feed/)
 *  [Ryan](https://wordpress.org/support/users/ryanmclaughlin1/)
 * (@ryanmclaughlin1)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/adding-a-search-results-page-to-your-site-like-an-rss-feed/#post-6092559)
 * if i am understanding you correctly, you want a google news feed on your site?
   not exactly wordpress specific, but i think i can help:
 * at the bottom of any topic on news.google.com there should be a link to an rss
   feed. click it, copy the url and then paste it into a wordpress rss widget on
   your site.
 * more info: [https://support.google.com/news/answer/59255?hl=en](https://support.google.com/news/answer/59255?hl=en)
 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [Make an image resource available to another plugin](https://wordpress.org/support/topic/make-an-image-resource-available-to-another-plugin/)
 *  [Ryan](https://wordpress.org/support/users/ryanmclaughlin1/)
 * (@ryanmclaughlin1)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/make-an-image-resource-available-to-another-plugin/#post-6094108)
 * Chris – take a look at [apply_filters](http://codex.wordpress.org/Function_Reference/apply_filters),
   which essentially allows you to pass values back and forth, instead of [do_action](http://codex.wordpress.org/Function_Reference/do_action).
   it might look something like this:
 *     ```
       function auto_featured_image_from_title ($post_id) {
           // $auto_image_width = something
           // $auto_image_height = something
           $post = get_post($post_id);
           $new_featured_img = imagecreatetruecolor($auto_image_width, $auto_image_height);
   
           $new_featured_img = apply_filters('afift_after_image_created', $new_featured_img, $post_id);
   
           $newimg = $upload_dir['path'] . '/' . $post_slug . '.jpg';
           imagejpeg( $new_featured_img, $newimg );
       }
       ```
   
 *     ```
       function write_text($img, $post_id){
           // $post_id is available if you need it for anything...
           // $text_color = something
           // $font = something
           $text = 'Hello, my friend.';
           return imagettftext($img, 20, 0, 20, 20, $text_color, $font, $text);
       }
       ```
   
 * hope it helps!
 * `add_filter('afift_after_image_created', 'write_text', 10, 2);`
 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [Load javascript in wp-admin/widgets.php](https://wordpress.org/support/topic/load-javascript-in-wp-adminwidgetsphp/)
 *  [Ryan](https://wordpress.org/support/users/ryanmclaughlin1/)
 * (@ryanmclaughlin1)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/load-javascript-in-wp-adminwidgetsphp/#post-6095740)
 * hello rauman – the form method is used to render the widget and by that point
   it is too late to enqueue scripts.
 * try creating a separate method that gets hooked to admin_enqueue_scripts ([https://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts](https://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts))
   and then register and enqueue your script from there.

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

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