[wp-trac] [WordPress Trac] #19342: Call to undefined function convert_to_screen when using plugins with custom meta boxes
WordPress Trac
wp-trac at lists.automattic.com
Fri Nov 25 07:55:03 UTC 2011
#19342: Call to undefined function convert_to_screen when using plugins with custom
meta boxes
------------------------------+---------------------
Reporter: jackdewey | Owner: rboren
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 3.3
Component: Template | Version: 3.3
Severity: major | Resolution: fixed
Keywords: has-patch commit |
------------------------------+---------------------
Comment (by dd32):
> While add_meta_box() is not one of them, some of the functions in /wp-
admin/includes/template.php can be useful outside the admin. Are you
saying that require_once() is bad for this specific file, or for any file
within /wp-admin?
In general, for any admin file, outside of an admin context is bad
practice, you shouldn't need to include files, except for certain files
which are not normally loaded, such as wp-admin/includes/upgrade.php
> I ask this more specifically because we currently have a plugin that
uses require_once() to load /wp-admin/includes/image.php because we need
to use wp_crop_image(), and also /wp-admin/includes/upgrade.php because we
need to use dbDelta().
upgrade.php is a special one, since it's not generally loaded, and should
only ever be included when needed, and only within an admin context.
image.php is a silly one, The image manipulation functions shouldn't
really be in admin includes IMO, and as you know, if you need to do image
alterations outside of the admin, you currently need to include it.
Hopefully that can change whenever media is touched again.
That being said, You certainly shouldn't be performing image manipulation
or database schema alterations in a front end request, it should be
deferred until the admin is viewed, or to a cron entry or similar.. for
the simple reason that multiple requests could cause a server overload
very fast when you consider that many image functions in PHP require >100M
of memory, and DB alterations can cause the same thing.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/19342#comment:11>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list