pastioke.com
Wordpress

Wordpress Plugin Path and Dir

Ditulis oleh Tim Pasti Oke
http://codex.wordpress.org/Function_Reference/plugin_dir_path

Function Reference/plugin dir path


Contents

[hide]

Description

Gets the filesystem directory path (with trailing slash) for the plugin __FILE__ passed in

Usage

<?php plugin_dir_path$file ?>

Parameters

$file
(string) (required) The filename of the plugin (__FILE__)
Default: None

Examples

Defining a constant to include files in a plugin, with the correct path
<?php
define( 'MYPLUGINNAME_PATH', plugin_dir_path(__FILE__) )
require MYPLUGINNAME_PATH . 'includes/class-metabox.php'
require MYPLUGINNAME_PATH . 'includes/class-widget.php'
?>

Return Values

(string) 
the filesystem path of the directory that contains the plugin

Change Log

Since: 2.8

Source File

plugin_dir_path() is located in wp-includes/plugin.php

Related

This can be fairly reliably used to find the local path to the plugins directory by using a string manipulation to remove just the base directory of the plugin (equivalent to the non-existent plugins_dir_path()).
plugins_url(), plugin_dir_url(), plugin_dir_path()
Retrieved from "http://codex.wordpress.org/Function_Reference/plugin_dir_path"

Butuh solusi instan siap pakai?

Dapatkan modul & script server production-ready langsung di web store kami.

Kunjungi Toko Digital

Komentar

Belum ada komentar. Jadilah yang pertama memberikan komentar!

Kirim Komentar