• Beehive - Google Analytics
  • Branda
  • Defender
  • Forminator
  • Hummingbird
  • Hustle
  • Shipper
  • SmartCrawl SEO
  • Smush
  • Snapshot
  • WPMU DEV Dashboard

Smush Hooks Documentation

Total hooks: 73
Undocumented hooks: 29

1. wdev-register-plugin

Type: action

If we are activating a version, while having another present and activated.

<p>Leave in the Pro version, if it is available.</p>

Arguments: WP_SMUSH_BASENAME, 'Smush', '/plugins/wp-smushit/', 'Get Fast!', '4b14b58816'

2. wp_smush_settings

Type: filter

Allow to add other settings via filtering the variable

<p>Like Nextgen and S3 integration</p>

Arguments: $this->settings

3. smush_skip_image_from_lazy_load

Type: filter

Filter to skip a single image from lazy load.

Arguments: false, $src

Arguments:

  • $skip - bool
    Should skip? Default: false.

  • $src - string
    Image url.

4. wp_smush_lazy_load_classes

Type: filter

Check if some image formats are excluded.

Arguments: $class

5. smush_file_exists

Type: action

Allows S3 to hook, check and download the file

Arguments: $backup_full_path, $attachment_id, array()

6. wp_smush_image_url_updated

Type: action

Perform a action after the image URL is updated in post content

Arguments: $image_id, $file_path, $original_file

7. wp_smush_image

Type: filter

Filter: wp_smush_image.

<p>Whether to smush the given attachment ID or not.</p>

Arguments: true, $attachment_id

Arguments:

  • $status - bool
    Smush all attachments by default.

  • $attachment_id - int
    Attachment ID.

8. wp_smush_image

Type: filter

Filter: wp_smush_image

<p>Whether to smush the given attachment id or not</p>

Arguments: true, $attachment_id

Arguments:

  • $skip - bool
    Whether to Smush image or not.

  • $attachment_id - int
    Attachment ID of the image being processed.

9. smush_file_exists

Type: action

No description

Arguments: $attachment_file_path, $attachment_id

10. wp_smush_resize_media_image

Type: filter

Resize the dimensions of the image.

<p>Filter whether the existing image should be resized or not</p>

Arguments: true, $attachment_id

Arguments:

  • $should_resize - bool
    Set to True by default.

  • $attachment_id - int
    Image Attachment ID.

11. image_smushed

Type: action

No description

Arguments: $attachment_id, $stats

12. wphb_clear_page_cache

Type: action

No description

Arguments: none

13. wp_smush_should_skip_parse

Type: filter

Internal filter to disable page parsing.

<p>Because the page parser module is universal, we need to make sure that all modules have the ability to skip parsing of certain pages. For example, lazy loading should skip if_preview() pages. In order to achieve this functionality, I've introduced this filter. Filter priority can be used to overwrite the $skip param.</p>

Arguments: false

Arguments:

  • $skip - bool
    Skip status.

14. smush_skip_image_from_cdn

Type: filter

Filter to skip a single image from cdn.

Arguments: false, $src, $image

Arguments:

  • $skip - bool
    Should skip? Default: false.

  • $src - string
    Image url.

  • $image - array, bool
    Image tag or false.

15. smush_cdn_image_tag

Type: filter

Filter hook to alter image tag before replacing the image in content.

Arguments: $new_image

Arguments:

  • $image - string
    Image tag.

16. smush_skip_background_image_from_cdn

Type: filter

Filter to skip a single image from cdn.

Arguments: false, $src, $image

Arguments:

  • $skip - bool
    Should skip? Default: false.

  • $src - string
    Image url.

  • $image - array, bool
    Image tag or false.

17. smush_image_cdn_args

Type: filter

Filter hook to alter image src arguments before going through cdn.

Arguments: array(), $image

Arguments:

  • $args - array
    Arguments.

  • $src - string
    Image src.

  • $image - string
    Image tag.

18. smush_image_src_before_cdn

Type: filter

Filter hook to alter image src before going through cdn.

Arguments: $src, $image

Arguments:

  • $src - string
    Image src.

  • $image - string
    Image tag.

19. smush_image_src_after_cdn

Type: filter

Filter hook to alter image src after replacing with CDN base.

Arguments: $src, $image

Arguments:

  • $src - string
    Image src.

  • $image - string
    Image tag.

20. smush_cdn_skip_image

Type: filter

No description

Arguments: false, $source['url'], $source

21. smush_srcset_additional_multipliers

Type: filter

Filter to add/update/bypass additional srcsets.

<p>If empty value or false is retured, additional srcset will not be generated.</p>

Arguments: array(0.2, 0.4, 0.6, 0.8, 1, 2, 3)

Arguments:

  • $additional_multipliers - array, bool
    Additional multipliers.

22. smush_skip_image_from_cdn

Type: filter

No description

Arguments: false, $url, false

23. wp_async_{$this->action}

Type: action

No description

Arguments: $postid, $_POST

24. wp_smush_get_admin_path

Type: filter

To be stored in DB, Part of code inspired from Ewwww Optimiser

Arguments: $admin_path

25. wp_smush_skip_folder

Type: filter

No description

Arguments: $skip, $path

26. wp_smush_convert_to_jpg

Type: filter

Filter whether to convert the PNG to JPG or not

Arguments: $should_convert, $id, $file, $size

Arguments:

  • $should_convert - bool
    Current choice for image conversion

  • $id - int
    Attachment id

  • $file - string
    File path for the image

  • $size - string
    Image size being converted

27. wp_smush_image_url_changed

Type: action

Perform a action after the image URL is updated in post content

Arguments: $id, $file, $n_file, $size

28. wp_smush_png_jpg_converted

Type: action

Do action, if the PNG to JPG conversion was successful

Arguments: $id, $meta, $savings

29. wp_smush_bg

Type: filter

Filter Background Color for Transparent PNGs

Arguments: $transparent_png['background'], $id, $size

30. wp_smush_image_url_changed

Type: action

Perform a action after the image URL is updated in post content

Arguments: $id, $file, $n_file, $size

31. wp_smush_error

Type: filter

Used internally to modify the error message

Arguments: $error, $attachment_id

32. wp_smush_format_attachment_meta_item

Type: filter

Allows to format single item in meta.

<p>This filter will be used only for Async, post requests.</p>

Arguments: $value, $key

Arguments:

  • $value - mixed
    Meta item value.

  • $key - string
    Meta item key.

33. wp_smush_query_limit

Type: filter

No description

Arguments: 2000

34. wp_smush_nextgen_query_limit

Type: filter

No description

Arguments: 1000

35. wp_smush_max_rows

Type: filter

Do not fetch more than this, any time Localizing all rows at once increases the page load and slows down everything

Arguments: 5000

36. wp_smush_resmush_mime_supported

Type: filter

Initialize class variables, after all stuff has been loaded

Arguments: $mime_supported, $mime

37. wp_smush_resize_uploaded_image

Type: filter

Filter whether the uploaded image should be resized or not

Arguments: $should_resize, $id, $meta

Arguments:

  • $should_resize - bool

  • $upload - array
    { Array of upload data.

  • $context - string
    The type of upload action. Values include 'upload' or 'sideload'.

38. wp_smush_image_resized

Type: action

Called after the image has been successfully resized Can be used to update the stored stats

Arguments: $id, $savings

39. wp_smush_resize_sizes

Type: filter

Filter the resize image dimensions

Arguments: array('width' => $this->max_w, 'height' => $this->max_h), $file_path, $id

Arguments:

  • $sizes - array
    { Array of sizes containing max width and height for all the uploaded images.

  • $file_path - string
    Original Image file path

  • $upload - array
    { Array of upload data.

40. smush_async_time_out

Type: filter

No description

Arguments: 0

41. smush_backup_exists

Type: filter

No description

Arguments: file_exists($backup), $image_id, $backup

42. smush_file_exists

Type: action

Allows S3 to hook over here and check if the given file path exists else download the file.

Arguments: $attachment_file_path_size, $id, $size_data

43. wp_smush_media_image

Type: filter

No description

Arguments: true, $size_key

44. wp_smush_media_image

Type: filter

No description

Arguments: true, 'full'

45. wp_smush_image_optimised

Type: action

Runs if the image smushing was successful

Arguments: $id, $stats, $meta

Arguments:

  • $id - int
    Image Id

  • $stats - array
    Smush Stats for the image

  • $meta - array
    Attachment meta.

46. wp_smush_image

Type: filter

Filter: wp_smush_image

<p>Whether to smush the given attachment id or not</p>

Arguments: true, $id

Arguments:

  • $skip - bool
    Bool, whether to Smush image or not.

  • $ID - int
    Attachment Id, Attachment id of the image being processed.

47. smush_file_exists

Type: action

Fix for Hostgator.

<p>Check for use of http url (Hostgator mostly).</p>

Arguments: $attachment_file_path, $attachment_id

48. wp_smush_image

Type: filter

Filter: wp_smush_image

<p>Whether to smush the given attachment id or not</p>

Arguments: true, $id

Arguments:

  • $skip -
    bool, whether to Smush image or not

  • $Attachment -
    Id, Attachment id of the image being processed

49. wp_smush_image

Type: filter

Filter: wp_smush_image

<p>Whether to smush the given attachment id or not</p>

Arguments: true, $id

Arguments:

  • $skip - bool
    Whether to Smush image or not.

  • $id - int
    Attachment ID of the image being processed.

50. wp_async_{$this->action}

Type: action

AJAX Thumbnail Rebuild integration.

Arguments: $id

51. smush_nextgen_auto

Type: filter

No description

Arguments: \WP_Smush::get_instance()->core()->mod->smush->is_auto_smush_enabled()

52. wp_smush_nextgen_image

Type: filter

No description

Arguments: true, $size

53. wp_smush_image_optimised_nextgen

Type: action

Runs if the image smushing was successful

Arguments: $image->pid, $stats

Arguments:

  • $ID - int
    Image Id

  • $stats - array
    Smush Stats for the image

54. wp_smush_nextgen_image_stats

Type: action

No description

Arguments: $image->pid, $stats

55. wp_smush_resmush_mime_supported

Type: filter

No description

Arguments: $mime_supported, $ext

56. wp_smush_resize_nextgen_image

Type: filter

Filter whether the NextGen image should be resized or not

Arguments: $should_resize, $image, $meta

Arguments:

  • $should_resize - bool

  • - object
    NextGen Gallery image object

  • - array
    NextGen Gallery image object

  • $context - string
    The type of upload action. Values include 'upload' or 'sideload'.

57. wp_smush_image_nextgen_resized

Type: action

Called after the image has been successfully resized Can be used to update the stored stats

Arguments: $attachment_id, array('stats' => $savings)

58. wp_smush_image_resized

Type: action

Called after the image has been successfully resized Can be used to update the stored stats

Arguments: $attachment_id, $savings

59. wp_smush_nextgen_image_stats

Type: action

No description

Arguments: $image_id, $stats

60. smush_retina_images

Type: filter

Allows to Enable/Disable WP Retina 2x Integration

Arguments: true

61. wp_smush_media_image

Type: filter

No description

Arguments: true, $image_size

62. wp_smush_enqueue

Type: filter

Do not enqueue, unless it is one of the required screen, or not in WordPress backend.

Arguments: true

63. smush_backup_exists

Type: filter

No description

Arguments: file_exists($backup), $image_id, $backup

64. wp_smush_admin_page_tabs_{$this->slug}

Type: filter

No description

Arguments: $this->tabs

65. wp_smush_admin_do_meta_boxes_{$this->slug}

Type: action_reference

No description

Arguments: array(&$this)

66. wp_smush_header_notices

Type: action

No description

Arguments: none

67. wpmudev_branding_hide_branding

Type: filter

No description

Arguments: false

68. wpmudev_branding_hide_doc_link

Type: filter

No description

Arguments: false

69. smush_setting_tabs

Type: filter

No description

Arguments: array('bulk' => 'Bulk Smush', 'directory' => 'Directory Smush', 'integrations' => 'Integrations', 'lazy_load' => 'Lazy Load', 'cdn' => 'CDN', 'tools' => 'Tools', 'settings' => 'Settings')

70. wp_smush_after_stats_box

Type: action

Allows to hook in additional containers after stats box for free version Pro Version has a full width settings box, so we don't want to do it there.

Arguments: none

71. smush_setting_column_tag

Type: action

No description

Arguments: $name

72. smush_setting_column_right_inside

Type: action

No description

Arguments: $name

73. smush_setting_column_right_outside

Type: action

No description

Arguments: $name