Tom J Nowell

United Kingdom

tomjn.com

Age: 27

I’m a VIP Wrangler at Automattic, a former Code For The People developer, a speaker at conferences, and an elected community moderator at WordPress Stack Exchange.

I also blog about WordPress and PHP at http://tomjn.com

Apr
25
revised Display value of custom field at the beginning of a post
Simplify and account for empty subtitles
Apr
24
revised Display value of custom field at the beginning of a post
This isn't appending, it's actually prepending
Apr
24
comment Display value of custom field at the beginning of a post
That should be escaping not sanitising, e.g. wp_kses_post or esc_html, you sanitize and validate on input, you escape on output. Your code also doesnt return the content when the _subtitle meta isn't present
Apr
24
awarded Notable Question
Apr
24
comment Display value of custom field at the beginning of a post
Plugin recommendations are offtopic here, I've ammended your question to remove this and improve the readability
Apr
24
revised Display value of custom field at the beginning of a post
Fixed some grammar, rephrased the title, removed an unnecessary paragraph and a request for a plugin recommendation
Apr
24
comment Display value of custom field at the beginning of a post
get_post_meta should be wrapped in an escaping function, that subtitle could be anything from "Hello world" to "<script>......"
Apr
24
comment Where to place functions and actions if functions.php is encoded?
Also, a plugin is just a PHP file with a comment at the top placed in the plugins folder that tells WP what the plugin is called
Apr
24
comment Where to place functions and actions if functions.php is encoded?
What do you mean by encoded? My personal recommendation would be to get a refund and look for another theme, but you may be able to use code reformatters depending on what you mean by 'encoded'.
Apr
21
revised Instantiate TinyMCE via JS ( rather than PHP/wp_editor )
added 123 characters in body
Apr
21
comment Instantiate TinyMCE via JS ( rather than PHP/wp_editor )
@jave.web awesome, that does the trick, I'll get to work updating my answer below
Apr
19
comment wp_insert_user role not working
If you have additional questions please create a new question, it's not fair on prosti to expand the scope indefinitely. The question mentions nothing about s1 membership. @prosti can you edit your answer to explain what you did? Copy paste code isn't an answer, and it doesn't help the OP understand what the problem was
Apr
18
comment How to implement secure frontend image upload?
If the OP wants to go one step further and add additional restrictions such as file size, dimensions, or age ratings/spam filtering/approval, I'm sure that can be covered in a new question, for the moment based on the question I think limiting it to testing if a file is or isn't an image would do the job, likely using the same whitelist the media uploader uses
Apr
18
comment Custom search for custom post meta with pre_get_posts interferes with WP search
I understand that, but I think you've misunderstood my request for clarification, it's clear that you're trying to optimise something, but that something doesn't make very much sense, and you've provided little context, which is important. We need to understand what you're originally tried to do if we're to optimise it, what does this page actually do? Your question implies you have a very strange setup, and that you're simply doing it wrong, and now you're trying to optimise that, but you've shown no context
Apr
17
comment Animated Gif as Featured Image
I would suggest asking 1 question per question, and simplifying your question to "How do I upload and use animated gifs, keeping the animation? Specifically for featured images". Asking how to eliminate resizing is an XY problem, and eliminates any answers that give you what you want that include resizing while preserving the animation, and just complicates the question
Apr
17
comment How to implement secure frontend image upload?
@MarkKaplun I think the question is clear Q: "How do you implement a frontend uploader with AJAX, that only accepts valid images", aka if a PHP file or a javascript file is put in the uploader, it doesn't work, only images
Apr
17
comment How to implement secure frontend image upload?
@Dennis you can edit your question to clarify, but keep in mind we have a 1 question per question policy. Simplifying your question and asking follow up questions rather than bundling it all in one question would dramatically increase the likelihood and the speed of getting an answer
Apr
17
comment Custom search for custom post meta with pre_get_posts interferes with WP search
Queries can be intercepted using the pre_get_posts filter, but lets say that you did indeed make WP_Query retrieve only the post meta, how would you pull that data out? WP_Query deals with WP_Post objects, that information is necessary. Even if you managed it, it would screw up any other code running on that page, and have unpredictable results. What you're trying to do is not the way things are meant to work, why is it you need the main query to fetch the meta for the posts and only the meta?
Apr
17
comment How to implement secure frontend image upload?
It may be better to phrase this as how to implement an AJAX file uploader in WordPress, while also specifying some constraints. It's a broad question ( almost too broad ) but still on topic. Perhaps it could be broken down into 2 parts, how to implement an AJAX file upload from the frontend, and how to secure that uploader to only work with images? That would make for 2 questions
Apr
17
comment Custom search for custom post meta with pre_get_posts interferes with WP search
There's no way to retrieve the post meta for a handful of posts, without retrieving the posts themselves, the purpose of WP_Query is to retrieve posts, and that's exactly what it's doing, and that's the job of the main query. What you're seeing is expected behaviour
1 2 3 4 5