Questions tagged [plugin-development]

WordPress Plugins allow easy modification, customization, and enhancement to a WordPress blog. Instead of changing the core programming of WordPress, you can add functionality with WordPress Plugins.

Filter by
Sorted by
Tagged with
14 votes
4 answers
52k views

Get page content using slug

I'm trying to get page content when I only know the slug string. Is there a function for this, or an easy way to do this or is this a case of doing it via SQL? Thanks very much
Alex's user avatar
  • 471
14 votes
3 answers
22k views

How do I change the author of a custom post type?

I have made a custom post type and need to be able to create posts and assign them to authors. It is easy to do this with posts as you can go to the bulk edit screen and immediately change the author. ...
fdsa's user avatar
  • 1,055
14 votes
2 answers
5k views

How to fork a plugin?

I want to start giving back to the community, but writing a plugin from scratch is currently slightly beyond my skill level and creativity level (meaning, I don't know what kind of problem I can solve ...
richardmtl's user avatar
14 votes
6 answers
29k views

How to echo the_excerpt without the P tag wrapper?

In the code snippet below, I trying to get the_excerpt to be written out without tags. However, the source formatting shows that the_excerpt is always wrapped in P tags. How can I pull the excerpt ...
Scott B's user avatar
  • 5,666
14 votes
5 answers
49k views

No Error Log File, no debug info

My error when writing a plugin for uploads and yes, I can debug. But it just jumps directly from this line to destruct the end of my wp-config.php EDIT: // Enable WP_DEBUG mode define('WP_DEBUG', ...
Toskan's user avatar
  • 514
14 votes
3 answers
3k views

How to prevent Composer dependency conflicts amongst WP plugins?

In our plugin development we use Composer to install e.g. Symfony\Process that we later use in the code. The big question is how do we make sure that this dependency is not in a conflict with some ...
Borek Bernard's user avatar
14 votes
3 answers
914 views

What are the advantages to the Settings API?

Let me preface this by saying that I hardly ever work with WordPress - in fact, the last time I did a site in WordPress was back during 2.2. Yesterday I made quite a mess of everything and asked ...
stevendesu's user avatar
14 votes
2 answers
2k views

Strategy On Building Plugin Using Eclipse

Anyone who has experience in building wordpress plugin using eclipse PDT? My situation is: I need to build plugin that extend another plugin (look at it as premium version from another plugin) I ...
ariefbayu's user avatar
  • 1,461
14 votes
4 answers
84k views

How to include wp-load.php from any location?

I have a plugin which calls a stand-alone php script (myAjax.php) via a jQuery.ajax() script inside the plugin. I need to place the following code into the myAjax.php file: require_once('../../../wp-...
N2Mystic's user avatar
  • 3,183
14 votes
2 answers
10k views

How can I configure Docker for developing and deploying a custom theme?

I am getting started with Docker and I'm still new to professional WordPress development practices. I would like to set up a Docker development environment (on my Mac) so that I can do custom ...
Andrew's user avatar
  • 419
13 votes
4 answers
25k views

What is difference between get_bloginfo('url') and get_site_url()?

I am developing a plugin. I want to know difference between get_bloginfo('url'); and get_site_url(); I got same output, then what's the difference?
I-M-JM's user avatar
  • 558
13 votes
6 answers
8k views

Where to store PHP files created by plugin / themes

There are cases in which a plugin or theme needs to create a php file somewhere that can later include it. For example a captcha plugin, or some kind of a templating system like twig/smarty (In my ...
onetrickpony's user avatar
  • 13.6k
13 votes
5 answers
759 views

Can a developer adopt a plugin marked as "not updated in over 2 years"?

I have come across a few WordPress plugins on http://wordpress.org/extend/plugins/ with this warning: This plugin hasn't been updated in over 2 years. It may no longer be maintained or supported ...
artlung's user avatar
  • 3,087
13 votes
6 answers
10k views

How can I update a wordpress plugin from a Git repository (github)

is there any way to easily update a plugin installed on multiple sites from a github repo. I know I can do it from the command line of each server using git pull. but is there a way to do it from the ...
dwenaus's user avatar
  • 1,242
13 votes
8 answers
22k views

How can I load a page template from a plugin?

I want to add page templates to a theme directly from the plugin. The idea is that the template would show up in the dropdown under Page Attributes, and all the code would need to be in the plugin. ...
smartcat's user avatar
  • 313
13 votes
5 answers
8k views

Stop a plugin in the activation process when a certain WP version is not met then show error message in admin_notices action hook

I have a plugin that I do not want to be activated if it doesn't meet a certain WP version number then show error message in admin_notices action hook. As far as I have researched, the code below is ...
Carl Alberto's user avatar
  • 1,067
13 votes
1 answer
18k views

Update my custom WordPress Plugin through my own server [duplicate]

I am working on a WordPress plugin that will be accessible only to a group of a few selected website owners. I have installed my plugin to those sites already. There is active development going on for ...
user avatar
13 votes
3 answers
2k views

Conditionally enqueue a widget's script/stylesheet in HEAD (only when present on page!)

I've been trying to load scripts and styles for a WordPress widget with the following conditions... The scripts MUST load in the HEAD (else they break). The scripts must ONLY load when the widget ...
Mark Jeldi's user avatar
13 votes
3 answers
11k views

Add screen options to custom admin pages

I want to add screen options to my plugin settings page, like the ones that are available in the Dashboard. I tried using the add_option method of the WP_Screen object and found that it supports only ...
Sudar's user avatar
  • 809
13 votes
3 answers
9k views

Get a path to a different plugin

To get a the path to a plugin you can use plugin_dir_path(__FILE__) - but this obviously has to be called from within the plug-in. How can you reliably get the path to plugin B (pluginb/pluginb.php) ...
Stephen Harris's user avatar
13 votes
1 answer
37k views

How can a plugin create a page/form in the front end?

How can a plugin create a page/form in the front end thats not listed in pages (if possible). it should only be accessed through a direct link.
Jiew Meng's user avatar
  • 1,921
13 votes
2 answers
22k views

How to add sub-menu to a menu generated by wp_nav_menu by using plugin

I have a menu generated by wp_nav_menu which look like <ul class="nav-menu" id="menu-top-nav"> <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-43" id="menu-...
Tahir Yasin's user avatar
13 votes
2 answers
2k views

Is There a Plugin Life Cycle Documentation?

Is there some documentation somewhere that explains what is the life cycle of the plugins? I'm starting a new plugin with OOP style, and I just found out that my main class is being instanciated a ...
RitonLaJoie's user avatar
13 votes
0 answers
345 views

Custom collection in media manager?

I'm working on a plugin that extends the media manager, load JSON based input data to render an own collection of images and may upload them to my wordpress media library. So far I got my own tab, ...
Sacer's user avatar
  • 131
12 votes
4 answers
234 views

What do you think about custom designed plugin/theme options UIs?

You probably noticed the trend of making custom designed plugin/theme options UIs, especially in the commercial ones (on CodeCanyon for example - custom boxes, tabs, accordions etc). I personally ...
depi's user avatar
  • 281
12 votes
3 answers
29k views

error_log() output for print_r() appearing on page

I am trying to debug a plugin and am using error_log() in various places to see what various things are. I am using the following: error_log( print_r( $variable ) ); When I look at debug.log, all I ...
Cedon's user avatar
  • 1,649
12 votes
6 answers
38k views

How to return only certain fields using get_posts()

I'm trying to get only the fields that I need using the get_posts() function in WordPress. I currently have the following code: $posts_args = array( 'orderby' => 'post_date', '...
Wern Ancheta's user avatar
12 votes
2 answers
5k views

How to Add an Index to Plugin Database table

I've created some additional tables for a plugin I'm developing and need to add indexes to these tables. What's the WordPress way to do this? Using dbDelta() doesn't seem to be working, and I'm ...
Milk's user avatar
  • 223
12 votes
1 answer
2k views

Giving Multiple Authors Access to a Plugin's WP.org Repo

A plugin I've released has a collaborator. So I put them into the readme.txt file and they show up on the plugin page and all that. Does doing this automagically give them access to the SVN ...
chrisguitarguy's user avatar
12 votes
2 answers
4k views

Symbolic Links on dev box with plugins and stylesheets

I'm using mac os x 10.6 with xampp. http://wp3.1/ is the url to where I have WordPress installed. The physical path is /Users/myUserName/Sites/wp3.1/ I do not install plugins or themes in the "...
mfields's user avatar
  • 2,687
12 votes
4 answers
759 views

Is it necessary to bump a plug-in's version if you're just updating the "Tested up to" attribute?

I've got a number of plug-in's hosted on the wordpress.org svn server ... with the immenent release of 3.1, I would like to update the "Tested up to" meta data. There will be no functional changes to ...
David G's user avatar
  • 357
12 votes
2 answers
9k views

Adding Widget form fields dynamically

I am trying to add form field to a WordPress widget dynamically. So if the user want to add another date to an event they can click a button to get more fields. The question is: How do save newly ...
Ole Henrik Skogstrøm's user avatar
12 votes
1 answer
3k views

Custom media upload content for inserting custom post shortcode

I’m working on a plugin that creates custom post type “portfolio” along with shortcode to insert in any page or post. The shortcode is: [portfolio option1=“1” option2=“0” option3=“1” ] And it works ...
Nikita's user avatar
  • 419
11 votes
3 answers
20k views

how to create child WordPress plugin

I like to create child plugin.. Explanation :- I have one parent plugin named X. This will work independently (like other existing plugins). Now I decided to add some extra features to that plugin ...
Gowri's user avatar
  • 851
11 votes
1 answer
7k views

function deactivate_plugins does not exist

I am getting function deactivate_plugins does not exist error when calling this function function deactivateSelf(){ deactivate_plugins(RSD_PLUGIN, true); //gives error: function ...
Radek's user avatar
  • 595
11 votes
3 answers
3k views

WP_Query leaking absurd amounts of memory

Every time I call WP_Query() in the function below, Wordpress leaks 8 megs of memory. And since I call this function a lot, things get hairy pretty quickly... :( I've tried unsetting the resulting $...
rinogo's user avatar
  • 1,441
11 votes
1 answer
17k views

What is the difference between $post_id and get_the_ID()?

What is the difference between $post_id and get_the_ID()? I could not find any documentation on $post_id.
grappler's user avatar
  • 845
11 votes
2 answers
2k views

How do I improve this admin query snippet to avoid generating duplicate results on non-meta searches?

I've been playing around with code snippets which add meta data to admin searches. The best snippet I've found was written by Stefano on this question. However, it appears to have 1, annoying bug ...
jnthnclrk's user avatar
  • 1,825
11 votes
3 answers
11k views

Where to store plugin settings fields

I am developing plugin right now, and I have one questions about best practices and conventions. What I need ? My plugin is going to store some predefined object, list of objects (or just ...
CROSP's user avatar
  • 437
11 votes
3 answers
6k views

How to output message during plugin activation

I am developing a plugin, but during the activation phrase I am constantly facing bugs. However there is no easy way to display error messages, since echoing stuff would result in 'unexpacted output' ...
lulalala's user avatar
  • 557
11 votes
2 answers
9k views

Include WP_Query in my own PHP file?

I want to write a cronjob for myself. But I need to get access to WP_Query and the permissions to delete posts etc. My question now is, how can I include the WP_Query function to my own PHP file and ...
Jan's user avatar
  • 307
11 votes
1 answer
2k views

Add self-closing shortcode button to TinyMCE in WP 4.6

I'm familiar with creating self-closing shortcodes like: // shortcode function wpse_shortcode_example( $wpse_atts ) { // Attributes $wpse_atts = shortcode_atts( array( '...
user9447's user avatar
  • 1,772
11 votes
2 answers
12k views

How to Add a Third Level Sub Menu to the Wordpress Admin Menu

Is there a function, action or filter that I can use to add a third level drop-down menu to the WordPress admin menu. For instance, right now in the sidebar menu, there is a menu for posts and under ...
Moshe's user avatar
  • 225
11 votes
2 answers
7k views

Custom Post Type Plugin: Where Do I Put The Template?

I'm writing a custom post type plugin. Part of it I'm outputting to the template via shortcodes. But other parts need a custom post template, and I figured out how to use the template hierarchy for ...
NotoriousWebmaster's user avatar
11 votes
1 answer
28k views

How to Use Checkbox in Custom Option Page Using The Setting API

Can you please let me know how I can add a checkbox to Setting API in creating Custom Options Page? I am using the following code to add a txt box which is working perfectly but I am totally confused ...
Mona Coder's user avatar
11 votes
1 answer
366 views

Does the number of downloads displayed for a plug-in in the WordPress.org plug-in directory include automatic updates?

I'm wondering how the number of downloads displayed in the plugin-directory correlates to the number of actual websites using the plug-in. I realise some people will download and never install and ...
Gilbert's user avatar
  • 163
11 votes
4 answers
21k views

Change the_title() of a page dynamically

I'm developing a plugin that doesn't use a custom post type, but separate database tables. It's a plugin that displays a list of courses with links that lead to the different course detail pages, ...
Gchtr's user avatar
  • 460
11 votes
2 answers
863 views

How to check uniqueness of plugin prefix?

To avoid collisions with other plugins, one should prefix all global functions, actions and plugins with a unique prefix, e.g.: function xyz_function_name() { ... } The question is, how do I verify ...
Borek Bernard's user avatar
11 votes
1 answer
1k views

Plugin API for easy admin list table generation, handling & exporting of MySQL tables?

I'm aware of the WP_List_Table class (which has helped tremendously as it stands). However, I'm hunting for something even more capable - some form of API whereby you could simply 'register' a MySQL ...
TheDeadMedic's user avatar
  • 36.4k
11 votes
0 answers
399 views

Hook in wp.media to add a new tab

This is an issue coming up while creating a plugin. I want to add a tab to the wp.media.view.MediaFrame.Select modal or if a general approach helps: In the customizer I want to hook in any modal ...
LeMike's user avatar
  • 388