580 reputation
412
bio website dynedrewett.com
location Devon, United Kingdom
age 32
visits member for 2 years, 5 months
seen yesterday

I'm an IT admin for a firm of solicitors in the South West of England.


Apr
2
comment Can posts have parents?
Also note that media attachments make use of the post_parent column, to identify which page/post (including custom post types) that they are attached to.
Feb
22
awarded  Popular Question
Feb
17
comment Warning: Cannot modify header information - headers already sent by (output started at ../wp-content/themes/shopifiq/functions.php:1)
@toscho - According the the PHP.net you should only omit the PHP tags in pure PHP files. php.net/manual/en/language.basic-syntax.phptags.php, see the third paragraph. Thanks.
Feb
17
comment Image MetaBox not saving in custom posts
Are you sure that your etpub_meta_save function is passing validation? Try adding die("Validation passed"); just before updating your update_post_meta() calls. Also, remove isset( $_POST[ 'etpub_nonce' ] ) from the nonce vitrification check, as if it's not set, it won't be valid, thus it's unnecessary.
Feb
17
comment Correctly delete posts with meta and attachments
The OP may have meant that, I guess it depends on how you interpret it. From past experience I've found that keeping potentially time consuming housekeeping tasks away from users contributes to a better experience, hence I interpreted it that way.
Feb
17
revised Correctly delete posts with meta and attachments
added 702 characters in body
Feb
17
comment Correctly delete posts with meta and attachments
Incorrect. You are querying the database once to get all attachments and then once per attachment when you delete them; 10 attachments = 11 queries in total. I query once to get all of the attachments and once to delete all of the associated posts; 10 attachments = 2 queries. It should be noted however that your code also deletes the file, where as mine merely removes the offending row from the database. I guess that is personal preference, but for performance I'd do it my way and then run some housekeeping to remove non-associated attachments (a simple plugin could handle that).
Feb
17
revised Correctly delete posts with meta and attachments
added 90 characters in body
Feb
17
comment Correctly delete posts with meta and attachments
I've updated my answer (obviously replace my_custom_post_type with the relevant Post Type). Also, check the link in the post for the before_delete_post() hook, it's fully explained in there.
Feb
17
comment Correctly delete posts with meta and attachments
While that works, I'd suggest making an array of ID's to delete, then constructing a custom query and running that. Your answer will run multiple queries to delete the attachments; perhaps not an issue for 3 or 4, but if you have 100 attachments it could slow things down quite considerably.
Feb
17
answered Correctly delete posts with meta and attachments
Feb
17
comment Correctly delete posts with meta and attachments
To the best of my knowledge there is no 'built-in' way of doing this, you'd need to build a way of doing it yourself. I'm not sure what your level of PHP/WP coding is, but essentially you'd have to run a query to find all attachments of the Post, another to delete them, another to find the Post meta, and yet another to delete them. I believe when you then delete the Post that WP handles the update of all the the Taxonomy tables for you, so there should be no action necessary there.
Feb
17
comment Warning: Cannot modify header information - headers already sent by (output started at ../wp-content/themes/shopifiq/functions.php:1)
Note also that while most servers compensate for it, some servers can't handle it when you don't close PHP (?>) at the end of a file.
Jan
31
comment WP_Customize_Image_Control generating error when used
Ah, it appears that header_image is already the name of a setting, and that it is associated with a different type of control (WP_Customize_Header_Image_Control). Renaming my setting has fixed this issue. Thanks for your help.
Jan
31
comment WP_Customize_Image_Control generating error when used
Thank you, I'll try that.
Jan
31
comment Add the “.current-menu-item” class to <a> tag?
I think you'd need to look at a custom Walker for this. Check out the Nav Menu docs for starters, and you'll find the Walker_Nav_Menu class (whcih you extend to make your custom walker) in /wp-includes/nav-menu-template.php. If that is what you want, update the question and I'll be happy to help.
Jan
31
comment WP_Customize_Image_Control generating error when used
It is load-scripts.php, not .js (brain fade / typo). Obviously that is the file that enqueues all of the WP scripts, but there is noting on line 2. Firebug does not specify (that I can see) which script file is causing the error, therefore I do not know where to look. Thanks.
Jan
31
revised WP_Customize_Image_Control generating error when used
added 1 characters in body
Jan
31
comment WP_Customize_Image_Control generating error when used
Please do some research on your own - How dare you accuse me of not doing my own research. You don't me, you have no right to make that accusation. My problem here is that I don’t know what to look for to solve this problem, or how to go about debugging it. That is why I have come to a question and answer site; to ask a question in the hopes of getting an answer. If you check my profile you’ll see that I have answered twice as many questions as I have asked, but none of those answers are related to this subject; I am new to Theme Customisation and I don’t know how it works within WP.
Jan
31
revised WP_Customize_Image_Control generating error when used
added 1 characters in body