For best pratices please see the WordPress coding standards, to be found in the Core Contributor Handbook.

learn more… | top users | synonyms

-2
votes
0answers
11 views

Custom pages layout solution

I have been in wordpress dev business for more than a year, made few themes for some friends but one question always pops in my head when I see a PSD template: How to deal with multiple dynamic ...
7
votes
5answers
2k views

Should I delete the default themes?

when managing a Wordpress site it gives me great pleasure to see nothing needs updating. Should I delete the default themes or is it best to leave them there? By default themes I mean: Twenty Eleven ...
1
vote
2answers
41 views

Clearing caches on plugin uninstall

When a plugin is uninstalled, it should remove all related data from the site (or network, if on multisite). If a plugin adds tables to the database, for example, it should remove those tables from ...
-1
votes
1answer
125 views

Why should I keep my personal WordPress separate from my “professional” one? [closed]

(this might be better suited as a community wiki, can one of the mods edit it please?) Info : I have one main blog, where I discuss IT stuff like programming, android, Java etc which compensates my ...
16
votes
9answers
763 views

Creative uses of WordPress [closed]

As WordPress grows, it becomes possible to make more and more sites using the technology. Pages and the permalink structure give it CMS power, custom taxonomies and post types expand this further to ...
0
votes
2answers
894 views

Install Wordpress on my VPS (Virtual Private Server)

Initial Research I have done: I know I need to have a database running with a section for WordPress. I found something called WebPI that I believe will make installation relatively simple, but I'm ...
45
votes
6answers
3k views

Best-of-Breed Features of a High-End WordPress Web Host? [closed]

I'm posting this as a community wiki because I'd like to get a collaboratively edited list of features for a high-end WordPress webhost. For example, if you are running a high-traffic WordPress-...
1
vote
2answers
42 views

Custom plugins/Manipulated plugins: Always a terrible idea to inherit these types of WP sites that discourage updates? [closed]

So I have been working on WP sites for a little bit now and I think I'm getting to the point where I'm starting to get to a wider range of clients with unique site builds. One site I was assigned to ...
9
votes
1answer
105 views

When should you, and when should you not, use wp_list_pluck()?

While learning about metadata lazy-loading, I met these lines of code: // Don't use `wp_list_pluck()` to avoid by-reference manipulation. $comment_ids = array(); if ( is_array( $comments ) ) { ...
18
votes
5answers
943 views

Why have <?php and ?> on every line

I've seen this convention pretty much everywhere, and, at times, it comes close to driving me nuts: <?php //The loop ?> <?php while ( have_posts() ) : the_post(); ?> <?php ...
0
votes
1answer
59 views

Best Practice - Customise a WooCommerce+Wordpress Templates

To integrate customise HTML/CSS to Wordpress without editing default ready theme template from Wordpress Download HTML5Blank Boiler plate modify/overide boilerplate css with our customise Css Create ...
4
votes
1answer
52 views

Preferred Use of home_url()?

This isn't a problem but rather I am just curious to see how others are using this function. The codex does not really say a preferred method of use although it does provide some straight-forward ...
13
votes
2answers
5k views

Best practices for localizing WordPress content?

A client asked for a blog that will have localized content (i.e. en.blogname.com for English content, fr.blogname.com for French content, etc). Being new to building such a blog, we recently ...
0
votes
0answers
29 views

pre_get_comments or the_content filter

I am learning wordpress deveplopment. I have a litle problem for understand how to use the right hook for add my code. In this case I have to ask... what is the best practice for show social icons ...
0
votes
1answer
24 views

Page with several user editable text content

I'm new to WP (not to making websites) and I'm trying to see which is the community approved standard way of having a page with several user editable content (text, images…). I'm thinking on pages ...
17
votes
4answers
3k views

Plugins in symlinked directories?

When I develop plugins I test them on multiple versions of WordPress by symlinking my plugin directory in the different wp-content directories. This is great since I only have to edit the files once, ...
0
votes
0answers
24 views

How to allow non-coder user to enter complicated data?

There are, of course, many ways to achieve the same thing, but I would like to recieve feedback on the way I have chosen to tackle this problem (because it feels a bit old-school and I suspect there ...
0
votes
1answer
33 views

Why Does WordPress not output admin-ajax.php path by default?

It's not uncommon for WordPress sites to have 10+ instances of the admin-ajax.php path outputted to the front-end for use by plugins and themes. Does anyone know if there is a reason WordPress core ...
1
vote
3answers
164 views

On which hook should I be calling register_nav_menu(s)?

I've variously seen register_nav_menus() called: on after_setup_theme on init pasted "loose" into functions.php with no apparent change in functionality. Which hook should I be using to call this ...
9
votes
2answers
297 views

Explanation of update_post_(meta/term)_cache

I was reading over some best practices from 10up and they mention setting these two flags to false in a WP_Query ( depending on what you're querying ): 'update_post_meta_cache' => false: useful ...
8
votes
4answers
9k views

don't publish custom post type post if a meta data field isn't valid

I have a custom post type (CPT) called event. I have a meta box for the type with several fields. I would like to validate some fields before publishing an event. For example, if an event's date is ...
0
votes
0answers
17 views

Best Practice - Multiple Templates & append Posts

I'm new to Wordpress and I've Html/Js/Php Knowledge. May I know is this a correct way to develop a custom theme site? I will have multiple templates files like : home,about,contact-us templates ...
0
votes
1answer
29 views

Associating special meaning with user id 0

I'm writing a plugin that creates a custom table holding data which is linked to a user account with a user_id field. Now if that users account would be deleted for any reason I would like to set that ...
0
votes
2answers
107 views

Theme file structure best practice

I'm building a custom theme and want to have an organized file structure. Is there a standard best practice? I looked at the file structure of popular starter themes and they all use different ...
0
votes
0answers
75 views

Is it bad practice to use $_POST['post_type'] in an action hooked on save_post?

In a custom plugin I wrote an action hooked on save_post that Only needs to fire when a particular Custom Post Type is modified Sometimes uses wp_insert_post to add a post of a second Custom Post ...
0
votes
1answer
30 views

What is the proper way to embed the HTML of an external form such as payflowlink from paypal?

I've had a request to paste in the following into a donations page for a group. The trouble is that WP is (rightfully) curtailing this HTML to prevent me or anyone from doing something less than ...
31
votes
8answers
12k views

Conditionally Loading JavaScript/CSS for Shortcodes

I released a plugin that creates a shortcode and requires a JavaScript file and a CSS file to load on any page that contains that shortcode. I could just make the script/style load on all pages, but ...
1
vote
1answer
39 views

Adding functions to hooks from within a class

Below is a trimmed down version of my plugin, to keep it simple. My setup function is being called, but when I go to the login page, it's not dying like it should. I had the plugin working earlier, ...
13
votes
1answer
18k views

get_template_directory() vs bloginfo( 'template_directory' ) vs TEMPLATEPATH

I was reading this article: Common WordPress Development Mistakes and How to Fix Them, and in it, they author says: Getting the theme location: If you are using TEMPLATEPATH or bloginfo( '...
1
vote
1answer
33 views

Plugin: register custom post types, child ready and performance best practices

I would find best practices in performance, clean code and child theme ready, for plugin that add some custom post types to my theme. What di you think about something like this? if ( ! ...
0
votes
1answer
59 views

Should I paste CDN links in a JS file or use a Bootstrap CDN plugin?

I'm new to WP development and I don't have the experience to know if I should place CDN links in a JS file and enqueue it or use a nifty plugin such as this one. What is best practice? What should I ...
0
votes
1answer
77 views

Custom Post Types and Removing Slugs - should we do it?

I've run into issues trying to remove my custom post types slugs and I've read other questions on here from people with the same problem. We don't want that slug in our URL! But the solutions to this ...
6
votes
4answers
4k views

When is get_template_part() preferable to simply using the template.php files?

In this post on wordpress.stackexchange.com I asked whether using get_template_part(), as demonstrated in the TwentyTen theme, is a recommended best practice. The general consensus I got was that it ...
0
votes
0answers
24 views

Registering an optional custom post type from a plugin

I see the codex notes to call flush_rewrite_rules() on plugin activation and deactivation when registering a custom post type from a plugin but I'm looking for the best practice if a plugin gives ...
9
votes
2answers
8k views

Use wp init hook to call other hooks?

I want to know if it is a good practice according to WordPress theme or plugin development. add_action('init','all_my_hooks'); function all_my_hooks(){ // some initialization stuff here and then ...
0
votes
1answer
127 views

Why user_pass column in wp_users table is varchar(64)

while working on a project, I found that "user_pass" column in "wp_users" table is varchar(64). WordPress always stores user password in md5 which is a 32 char ASCII string. So why not store it in ...
1
vote
2answers
74 views

Should non-WordPress data get its own DB?

I couldn't find anything on Google or on here about best practice for data that is not really Wordpress related. Say we have a database of clients that we'll be accessing through PHP/SQL. Should I ...
0
votes
1answer
68 views

Best Method to Switch Between Terms (Custom Taxonomy)

Looking to learn something, here. With the following code, I am loading an external file for each condition based on a known set of custom terms. I'm using has_terms to check for a specific value ...
0
votes
0answers
73 views

Best practice: What belongs in theme and what in plugin for large eCommerce website

I am about to create a large custom eCommerce website that does not fit within WooCommerce. (Most of the times I use WooCommerce for eCommerce.) It has also a completely custom design. However I know ...
7
votes
2answers
3k views

add_action(), add_filter() before or after function

When looking through WordPress snippets/tutorials/plugins I often see add_action() and add_filter() being placed before the function is declared: add_action( 'publish_post', 'email_friends' ); ...
13
votes
6answers
4k views

How to benchmark a WordPress installation? [closed]

I'm trying to gather some benchmarking data to determine how well my optimizations to WordPress are fairing. I've found this page on High Traffic Tips but it doesn't contain any data. Are there any ...
5
votes
2answers
287 views

Using filters and actions for plugin API?

I want to integrate a public API to a plugin that I develop. The usual way other plugins integrate APIs is to define some functions that can be called by any theme or plugin. However, I think this ...
0
votes
2answers
155 views

Custom templates vs page-slug

I've currently been using the slug to set the page template, using the normal hierarchy For example, if I wanted to change the page template for http://www.example.com/about-us, I would edit page-...
1
vote
0answers
86 views

Best Practices for a Completely Customizable Homepage - without plugins

Let's say you have a homepage where you want to be able to feature 10 posts of various types (posts, pages, and Custom Post Types). You have hundreds of these posts to choose from. What would be the ...
13
votes
3answers
15k views

How do i best handle custom plugin page actions?

I'm constantly running into the same annoyance, so i thought i'd see if there's any ideas or experience out there... I've created a plugin that uses it's own admin page. It has to. Now that i sorted ...
20
votes
8answers
3k views

What is your best practice to execute one-time scripts?

The Problem We all have been in a situation like this, and a lot of questions on this site need a solution like this. You either have to update a database, insert a lot of data automatically, convert ...
0
votes
1answer
841 views

Can a plugin add to header/footer/body content?

I am just wrapping up my first WordPress plugin and the last thing I would like to do is take a piece of data that the plugin knows about (from wp_options table) and display it in either the header or ...
0
votes
1answer
44 views

Plugin Development - Functions or Hooks?

I am brand new to WordPress plugin development and have a few questions, mostly about best practices but also some specifics. Essentially I just want to trigger an action (invoking a PHP class and ...
0
votes
2answers
1k views

Assign Page Template Within A Custom Post Type

I have registered a Custom Post Type and created a file called archive-myCPT.php and another one for single posts called single-myCPT.php. What I want to do is to create a page where I will show just ...
4
votes
3answers
1k views

Best Way to Create a List of Musician Gigs in WordPress

I am currently designing a musician's wordpress theme, and am looking to create a user-controlled dynamic gig list. I've done this before using PHP, but am wondering what the best way to do it in ...