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.

learn more… | top users | synonyms (1)

6
votes
2answers
397 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 ...
6
votes
1answer
281 views

Optimize shortcode callbacks

I created a plugin to add some shortcodes in my WordPress site. But I'm a PHP newbie, so I believe it may have some errors or ways to optimize it. It's working fine, and apparently there are no ...
5
votes
4answers
568 views

How to control output of custom post type without modifying theme?

I have a custom post type 'properties' that I'd like to control the HTML output for. For simplicity, let's focus on the archive view. As a basic example, here is what a loop looks like in an ...
5
votes
3answers
770 views

How do I log plugin (cron) actions?

Is there a recommended way to log (failed) cron actions from your plugin? For example, I have a plugin that synchronizes with an external service every hour. I want to log how much was changed, but ...
4
votes
1answer
626 views

Creating a user's own folder on user registration

I need a plugin or some guidence on creating a user's own folder on user registation. For example...A user clicks on Register and registers ... I need wordpress to create a directory which would be ...
4
votes
2answers
793 views

Make Categories and Tags required in admin

Hello i started from Bainternet solution in this post: don't publish custom post type post if a meta data field isn't valid I made a plugin to make categories and tags required. The ...
4
votes
2answers
13k 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: ...
4
votes
4answers
1k views

How to auto-upgrade my plugin?

How do I have my plugin pop up with that New version available. Upgrade Automatically dialog to appear when my plugin has a new version? Specifically for plugins not hosted on the WP.org repository.
4
votes
3answers
6k views

add_action hook for completely new post?

publish_post Runs when a post is published, or if it is edited and its status is "published". Action function arguments: post ID. -Plugin API Documentation I've added the publish_post ...
3
votes
3answers
2k views

Is there a hook for when you switch themes?

I created a plugin but I just came across a bug that I don't really know how to solve. When you activate my plugin, it creates a file in the active theme directory and when you deactivate it, it ...
3
votes
3answers
1k views

Creating two database tables via plugin

I'm working on a voting plugin for my site and I want to create 2 tables: one that stores votes and another that stores voter ips. In Codex it suggests to use an if statement to see if the table has ...
1
vote
4answers
517 views

URLs of plugin resources?

I am trying to add in a script and css file for my plugin into the admin header. Is there a function similar to get_bloginfo('url') that I could use to reference the files correctly without having to ...
8
votes
1answer
4k views

How are bulk actions handled in custom list table classes?

I'm working on a custom data table to display in the WordPress dashboard. The table populates from a database table I built in a plugin. I've been using the provided WordPress Custom List Table ...
6
votes
1answer
1k 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 ...
6
votes
3answers
346 views

Releasing new plugin version, how to rename old options keys?

I have everything ready for publishing a new version of my plugin but one last issue stands... The old version had no naming convention for its key option names. The options grew and I renamed all ...
6
votes
3answers
891 views

Replace audio/video enclosure with player?

Current state: I'm parsing XML feeds into the front end and/or the back end (Admin UI), but not into the DB. Inside those feeds i place mp3- and video content, currently only as plain text (no link, ...
5
votes
2answers
4k views

Send user activation email when programmatically creating user

I wondered if someone here might be able to help. Basically, I've created a custom registration form that when validated, inserts a user to the user table. function _new_user($data) { // ...
5
votes
1answer
228 views

Completely remove WP_Admin_Bar for specific user roles

How do I hide/remove the admin bar that is displayed when a user with specific role is logged in? I figured I have to do something with remove_menu(), but not exactly what and how. Codex
5
votes
2answers
378 views

How would I create a plugin for my shortcodes?

All tutorials I have found say to add your shortcodes to functions.php in your theme. I would like to break that away from my theme and put that in a plugin so I can share these shortcodes between my ...
5
votes
2answers
276 views

Best practice for including plugins as part of a theme?

I'm working on a theme that includes some functionality I've developed as separate plugins (as I'm hoping to release them independently). I'd like to include these plugins as part of the theme core ...
4
votes
4answers
233 views

Can i do plugin commits directly from a plugin folder inside an installation using the Trunk SVN

I have several virtual hosts setup, three of them pull files via SVN when needed(though only the trunk folder actually needs this), using SVN for other versions make for easy patch creation, or easy ...
4
votes
3answers
4k views

Which hook should be used to add an action containing a redirect?

I want to build a plugin that grabs certain url params from the query string to build a new query string for the same page. I'm following the excellent the Professional WordPress Plugin Development ...
4
votes
3answers
568 views

Is there a way for a plug-in to get it's own version number?

Is there an API I can call, inside my plug-in, to determine the plug-in's version? I just want to have my plug-in emit a html comment with it's own version number ... for diagnostic purposes.
3
votes
1answer
394 views

Do I need to call do_action in my plugin?

Do I need to call do_action function every time I add_action something?
2
votes
1answer
224 views

Add Admin Menu Inside Construct or Init

I thought I was making headway in my WordPress Development education until I ran across the Boilerplate for WordPress plugins and it uses a class object. I'm fine with that and understand those ...
2
votes
1answer
3k views

Update Option Stored in Multi-Dimensional Array

I have data in the wp_options table currently stored as a multi-dimensional array (profile_element_order): ...
1
vote
2answers
896 views

Is get_option function cached?

In my plugin, I use the following code to retrieve an option from the database: $options = get_option('my_plugin_options'); If I use this 10 times in various functions of my plugin, does WordPress ...
1
vote
1answer
186 views

One time username change from frontend?

I'm using facebook connect plugin. Usernames generated by that plugin look like firstname_lastname. I mean it looks ugly. I would like to give the privilege to my users to change the username BUT ...
1
vote
3answers
557 views

Two-step login process - Is it possible?

Is it possible to do the following with Wordpress (without hacking too much code - I would like to make this a general plugin using simple hooks)? Log in with the username/password. If ...
1
vote
3answers
2k views

anything like add_meta_box for categories?

I want to add few custom fields to categories. So I am looking for something like add_meta_box but for categories. Is there any WP function like that for categories?
0
votes
1answer
3k views

add_meta_box() to Category Edit Screen?

I've got a plugin that attaches itself to both the post and page editors to read and write to the post_content object. I'd like to also attach my plugin to the category manager edit screen. In the ...
7
votes
10answers
6k views

Wordpress Plugin Development - Headers Already Sent Message

I'm developing Wordpress plugins. When i activate my plugin, i'm getting a message The plugin generated 293 characters of unexpected output during activation. If you notice “headers already ...
6
votes
2answers
14k views

How to get the path to the current theme?

This code is used to get the directory of the current plugin: plugin_dir_url( __FILE__ ). What should I use to get the directory of the current theme?
6
votes
4answers
6k 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?
5
votes
2answers
219 views

What is the difference between using global $current_screen and get_current_screen()?

I have been looking at get_current_screen();. I have seen there is also a global $current_screen; that I could use. Here are two examples: // Using function function wpse_post_notice() { ...
5
votes
1answer
611 views

How do you create an archive for a custom post type from a plugin?

So I'm creating a plugin to create buildings that list condos for sale. The simplest way to do this was to just create a custom post type for the buildings and then the listings but I'm now stuck on ...
4
votes
1answer
1k views

Plugin - create a page without it appearing in the side menu

I am currently using add_submenu_page to add pages for my plugin. However, I wish to create a page that don't appear in the admin menu, is that possible?
4
votes
2answers
3k views

What is the difference between the “wp_footer” and “get_footer” actions?

I am working on developing a plugin, and I am trying to add a line of text to the bottom of the page, I see there are two actions that seems reasonable, wp_footer() and get_footer(). wp_footer sounds ...
4
votes
2answers
171 views

Where do I start from

I'm student web developer and I'd like to know the things I should know before venturing into WordPress. Where do I start?
3
votes
3answers
2k views

Where, When, & How to Properly Flush Rewrite Rules Within the Scope of a Plugin?

I am having a bit of a strange issue with rewrite rules not flushing properly. I have tried using flush_rewrite_rules(); and flush_rewrite_rules(true);. I have also tried globalizing $wp_rewrite ...
3
votes
2answers
923 views

Overwriting Core Wordpress Functions with Plugins

Is there a way to overwrite a core function is the Wordpress core using a plugin? I don't need to inject code, I need to replace the function entirely with a re-written version. The specific function ...
2
votes
1answer
93 views

Wordpress Media mime type filter problem 4.0

I have added new mime types with the 'post_mime_types' filter eg. PDF, doc, mp3 etc... Filtering by custom mime type on the upload.php page in media grid view works as expected but in list view it ...
2
votes
2answers
1k views

Headers already sent error with CSV export plugin

I have built a Wordpress plugin that allows the user to export all pages, with their levels and urls, to a csv file. The problem I have is that I keep getting error messages when trying to export ...
2
votes
1answer
601 views

How to set a fall back template for a custom post type in a plugin?

My custom plugin creates a custom post type, and I want to theme my own "single-my_custom_cpt.php" file. However, I want to store it in my plugin folder, and allow that it be over-written in the ...
2
votes
5answers
771 views

How to debug WordPress correctly?

I'm using a few plugins and UpThemes framework on my new website and if I turn on Wp Debug I can see that there are a few errors related to Deprecated functions (but website is working). What I would ...
2
votes
1answer
1k views

What action is called when drafts are saved?

I would like to add a metadata field to the current post based on a checkbox in a custom meta box to be able to toggle my custom plugin on a post by post basis. For this I coded the following things ...
2
votes
2answers
822 views

Calling clean_term_cache() fails when called in the same plugin that creates terms, succeeds when called separately?

My plugin code is below. In the myPlugin_cleanup() function, I'm creating some categories and assigning term id 1 as the parent. Due to the known bug with creating categories via script (the ...
2
votes
1answer
889 views

How to show custom message once on plugin activation?

I know by watching the akismet plugin source how to show a custom message on the plugins page, but I want my message to appear only once after my plugin is activated. How could i do this?
1
vote
2answers
244 views

WordPress 4.0 Cookie Authentication to avoid nonce error when publishing a post and page

Cookies are now tied to internal sessions in WordPress 4.0. This means plugins using basic cookie authentication will have trouble because a token is required for publishing a post or page (as well ...
1
vote
1answer
189 views

How to add a new plugin page under desired Options page?

Using WordPress Settings API tutorial I created a new custom menu and corresponding sub menus. Each of my menus have a page of its own. I used add_menu_page() and add_submenu_page() for that. (Here is ...