Un motore di ricerca WordPress per sviluppatori e autori di temi



_wp_get_attachment_relative_path ›

Da4.4.1
Deprecaton/a
_wp_get_attachment_relative_path ( $file )
Accedi:
  • private
Parametri:
  • (string) $file Attachment file name.
    Richiesto:
Ritorna:
  • (string) Attachment path relative to the upload directory.
Definito a:
Codex:

Get the attachment path relative to the upload directory.



Sorgenti

function _wp_get_attachment_relative_path( $file ) {
	$dirname = dirname( $file );

	if ( '.' === $dirname ) {
		return '';
	}

	if ( false !== strpos( $dirname, 'wp-content/uploads' ) ) {
		// Get the directory name relative to the upload directory (back compat for pre-2.7 uploads)
		$dirname = substr( $dirname, strpos( $dirname, 'wp-content/uploads' ) + 18 );
		$dirname = ltrim( $dirname, '/' );
	}

	return $dirname;
}