Tag Info

Hot answers tagged

12

If you must hack core, consider doing so in a way that makes it extensible for others. Add an Action Hook Nine times out of ten, you could do what it is you wanted if only there was an extra do_action call in a specific file. In that case, add the action, document it, and submit a patch via Trac. If there's a good reason for your patch (i.e. you're not ...


8

The easiest way to create a patch is described here: http://wordpress.org/download/svn/ Can I create patches from older version or must I use trunk? You should create the patch against the same version you want it applied against. In other words, don't expect a patch created against WP 3.0.1 to apply cleanly on WP 3.1-alpha. If I'm working on a ...


7

The active plugins are stored in the 'active_plugins' option, like this: array( 'akismet/akismet.php', 'hello-dolly.php', ); On each page load, WP just loops through that array and includes those files. It's up to each plugin to include any additional files that it may have. When a plugin is deactivated, it's just removed from that array. On the next ...


7

This makes not that impressive answer, but - none. get_ is suffix usually means function returns something, the_ that function echoes something. wp_ doesn't carry technical meaning and inconsistency in naming is from many developers participating and lack of movement to unify (moving forward is considered more important than major cleanups of older stuff ...


7

register_post_status is used for creating a custom post status. The protected argument, if true, specifies that a user must be logged in and have edit permissions on the post to view (preview) it. For example, you said that the "draft" post status has protected set to true. This means that you can only view (preview) the draft post if you have permission ...


7

This question is going to get some opinion based answers, but well, I'll give it a try. There are a couple of reasons why someone might've told you that, it would be great to know the context also. Upto version 3.4 or 3.5, that function only worked when the parameter was a var, that might be one of the reasons why someone told you that. I, myself, don't ...


7

For starters let's dive into what is 5 really. It is the post's ID. But what is ID in turn? It is value in the MySQL table row which identifies the specific post record. Issues with using IDs So first there are some conceptual problems with it. It's not content. It's not something user creates, manipulates, or (most of the time) aware of. WP is (by design) ...


6

The best reason not to hack core is that whatever you are doing should be reworked as a patch for core instead! Obviously ALL of your code would not make a good patch at all, or at least it rarely would. Instead you need to figure out what hook (action or filter) is missing in core that would let you do whatever it is you need to do without hacking core. ...


6

More than an Answer, this is a research and a compilation. Database Description already in Damien answer. A Google search reveals this in WordPress forums: UML documentation of WordPress As far as I know, that's all we have. If you want to write one, I'm sure it'd be welcomed :) (Ipstenu, referring to the Database Description) UML of ...


5

Pull down the copy of Wordpress from your client's server to your local. Download a clean zip of the version of Wordpress your client has installed. http://wordpress.org/download/release-archive/ From there, you will need to use a file comparison tool (i.e. Diff on Linux). You can also use GIT to find the difference in folders by creating a GIT repo of the ...


5

Try putting this in your functions.php function wpse60605_change_username_label( $defaults ){ $defaults['label_username'] = __( 'Username or Email' ); return $defaults; } add_filter( 'login_form_defaults', 'wpse60605_change_username_label' );


5

Your .htaccess lines need to look like this: RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] # uploaded files RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) /wordpress/wp-includes/ms-files.php?file=$2 [L] # add a trailing slash to /wp-admin RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] ...


5

Eclipse PDT + Subclipse + X I'm using Eclipse that has SVN Integration. I think PHP Strom does so as well. I go into one of my trunk projects which are basically a checkout from WordPress svn repository. Then I edit the files I need to edit. Eclipse shows which are modified, I right-click a directory, select Team->Create Patch and I get offered all ...


5

The "Log In" string is passed to the translation function, and you can filter that. To prevent needing to filter every little string, you can activate this filter right before the login form is printed. add_action( 'login_form', 'wpse17709_login_form' ); function wpse17709_login_form() { add_filter( 'gettext', 'wpse17709_gettext', 10, 2 ); } function ...


5

I believe it was added back on WordPress 2.6 (maybe 2.5). It's there to allow you to set a maximum width on images being displayed as content in your theme. E.g. If your main content area is only 475px wide, you could set $content_width = 450 to make sure your image doesn't break out of your main content area.


5

Not sure if there actually is a in scope answer for what you are asking, but the below are some hopefully helpful informations/thoughts. Besides that, I don't know about (all) the tools you are mentioning, but thats secondary anyway. What you want, of course, is to keep the development process, like you described it, alive. As you said, it looks like this: ...


4

Looks like this is a defect. Ish. As @s_ha_dum mentioned, this is to prevent a directory traversal attack. However, Wordpress' Media Library will happily let you upload a file with two or more periods in a row, even if ms-files.php will refuse to serve it up. So, nothing is technically "broken", but this certainly isn't ideal. There's a patch to prevent ...


4

Disable Plugin updates all together It should be as easy as that: <?php defined( 'ABSPATH' ) or exit; /* Plugin Name: (#120589) Disable Plugin Updates */ remove_action( 'load-update-core.php', 'wp_update_plugins' ); Deny (or reroute) Updates for Themes/Plugins Single core and theme updates can be deactivated by this script my Mark Jaquith: For ...


4

Navigating WP admin in general tends to trigger multiple external requests, such as fetching news feeds and theme/plugin updates (not counting whatever plugin/themes might be doing on their own). You can put configuration constants into wp-config.php to block external requests completely/partially: define( 'WP_HTTP_BLOCK_EXTERNAL', true ); define( ...


4

The most definitive and up to date answer about best practice can come probably only from the wordpress.org theme review team, and right now they are different from the codex. just quoting it here, but I'm sure it might change with time Themes are required to support the following WordPress-defined CSS classes, or similar elements: Alignment Classes: ...


4

Somewhat related: I don't know if it's reasonable to use $content_width if you plan on developing a theme that allows flexible design options. For example, let's say that your #content will be set to 512px if a user has sidebar widgets active and 768px if a user has no sidebar widgets active. I see no reason why CSS isn't enough to handle image overflows in ...


4

Unfortunately, no. Globals definitions are scattered throught the codebase. There's no documentation for most of them, either.


4

I'm not sure if all of these are WordPress globals, but i did a quick grep type search of the WordPress files and tried to extract all the globals i could.. This is a list i compiled for you, that may not be perfect, but should *hopefully* represent alot of the $GLOBALS keys that WordPress uses, it won't account for globised variables that aren't explicitly ...


4

There is get_core_updates(). Note that you might need to manually include admin file that declares it, if running in front end and such. Example use: require_once ABSPATH . '/wp-admin/includes/update.php'; print_r( get_core_updates() ); Example return: Array ( [0] => stdClass Object ( [response] => latest ...


4

If you are looking for the database schema, there is a version on the Codex: click to enlarge The image you referenced in your post is the template hierarchy most commonly used by theme developers.


4

First should only disable SQL_CALC_FOUND_ROWS if you aren't using pagination, to do so set parameter no_found_rows to true in WP_Query. WP_Query( array( 'no_found_rows' => true ) ); Note get_posts() does that by default.


4

Files named "core" are created when some OS process crashes. In your case it was likely a crash of the php interpreter. These files being memory dumps are used to debug the process "postmortem" - e.g. to check in which function did it fail, so it is perfectly safe to delete them if you are not going to debug the issue. In fact, on many systems there is a ...


4

The $post->filter contains the context under which the contents of the post have been filtered. Context could be something like "display" indicating the post is meant to be displayed on the page. This is done by the sanitization functions, to indicate under what context the post data was sanitized. Different contexts get different types of sanitization. ...


4

You can hook on option_update_core and edit the update url, as a plugin you can do something like this (Remember to disable the plugin after updating wordpress) add_filter('option_update_core','wpse_26750'); add_filter('transient_update_core','wpse_26750'); function wpse_26750($options){ global $wp_version; $updates=array( ...


3

You can hook manage_users_columns to add (and I suppose remove) columns from the All users display. This tutorial details that. You might be able to hook user_edit_form_tag to do the trial vs not trial at the top...but I'm not sure, you'd have to tinker with it. I think you'll probably end up having to use something else (WP_Error might be a good way to ...



Only top voted, non community-wiki answers of a minimum length are eligible