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.
6,651
questions
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
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. ...
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 ...
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 ...
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', ...
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 ...
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 ...
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 ...
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-...
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 ...
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?
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 ...
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 ...
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 ...
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.
...
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 ...
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 ...
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 ...
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 ...
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) ...
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.
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-...
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 ...
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, ...
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 ...
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 ...
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',
'...
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 ...
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 ...
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 "...
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 ...
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 ...
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 ...
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 ...
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 ...
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 $...
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.
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 ...
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 ...
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' ...
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 ...
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(
'...
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 ...
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 ...
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 ...
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 ...
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, ...
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 ...
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 ...
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 ...