Filter hook '_wp_relative_upload_path'

in WP Core File wp-includes/post.php at line 916

View Source

_wp_relative_upload_path

Filter Hook
Description
Filters the relative path to an uploaded file.

Hook Information

File Location wp-includes/post.php View on GitHub
Hook Type Filter
Line Number 916

Hook Parameters

Type Name Description
string $new_path Relative path to the file.
string $path Full path to the file.

Usage Examples

Basic Usage
<?php
// Hook into _wp_relative_upload_path
add_filter('_wp_relative_upload_path', 'my_custom_filter', 10, 2);

function my_custom_filter($new_path, $path) {
    // Your custom filtering logic here
    return $new_path;
}

Source Code Context

wp-includes/post.php:916 - How this hook is used in WordPress core
<?php
 911  	 * @since 2.9.0
 912  	 *
 913  	 * @param string $new_path Relative path to the file.
 914  	 * @param string $path     Full path to the file.
 915  	 */
 916  	return apply_filters( '_wp_relative_upload_path', $new_path, $path );
 917  }
 918  
 919  /**
 920   * Retrieves all children of the post parent ID.
 921   *

PHP Documentation

<?php
/**
	 * Filters the relative path to an uploaded file.
	 *
	 * @since 2.9.0
	 *
	 * @param string $new_path Relative path to the file.
	 * @param string $path     Full path to the file.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/post.php
Related Hooks

Related hooks will be displayed here in future updates.