Function Reference: geodir_only_supportable_attachments_remove

Summary

Delete only supported attachments. This function is hooked to wp_delete_file filter.

Global Values

$wpdb
(object) (required) WordPress Database object.

Default: None

Package

GeoDirectory

Parameters

$file.
(string) (required) The File path.

Default: None

Return Values

(string)
  • File path if valid.
  • Else empty string.

Change Log

Since: 1.0.0

Source File

geodir_only_supportable_attachments_remove() is located in geodirectory-functions/post_functions.php [Line: 2876]

Source Code

function geodir_only_supportable_attachments_remove($file)
{

    global $wpdb;

    $matches = array();

    $pattern = '/-\d+x\d+\./';
    preg_match($pattern, $file, $matches, PREG_OFFSET_CAPTURE);

    if (empty($matches))
        return '';
    else
        return $file;

}