Tom J Nowell

United Kingdom

tomjn.com

Age: 26

I'm a fulltime WordPress Developer at Code For The People in the UK. I also build RTS AIs & attend WordPress/design conferences.

Any questions please say hello, I can normally be found in the WPSE chat ( link in the top header ).

18h
comment post_type_exists keeps returning false
Plugin activation is a popular one, usually the user needs to visit the permalink page and the rules are flushed automatically
19h
answered post_type_exists keeps returning false
2d
comment attach image from library to post with wp_insert_attachment
If they are in the media library then they are attachment posts, do you mean you copy pasted or transferred the files there rather than uploading them via the admin interface? If they show in the media library they are already attachments
Nov
21
comment Reset/Reorder posts ID in the MySQL wp_posts table
It is a lot of work that will need repeating anytime a post, revision, or media file is deleted, with no guarantee it will be foolproof
Nov
21
comment Reset/Reorder posts ID in the MySQL wp_posts table
Those are not small numbers, 2 factor auth numbers used by Google and Banks are 6 digits, and science says we can hold between 5 and 7 digits in our head fine. What you actually have is a usability issue, making your users remember numbers is an awful, awful idea, and will not scale. What happens when you have 9,999 posts? Eitherway what you're trying to do requires a lot of MySQL knowledge, you'd be better off asking how to implement a proper user interface with a dropdown or an autocomplete to pick a post rather than going with the copy paste a number scheme
Nov
21
comment attach image from library to post with wp_insert_attachment
If the file is in the uploads folder, then it should already have an attachment post. Also when you're calling wp_update_post, what is specifying 'ID' => $attach_id intended to DO?
Nov
20
comment Reset/Reorder posts ID in the MySQL wp_posts table
I've seen plenty of sites with a lot more than 7000 posts, I very much doubt you will get the performance gains you expect from doing this, and keep in mind you will need to update all the post meta tables, the term relationships, any options that store post IDs, clear all your object caches, transients, and any URLs that contain post IDs will no longer work or lead to the wrong location. Your post IDs are as unique as they ever will be, a gap doesn't change that ( and gaps will happen once a post is deleted anyway ). I suspect micro-optimization
Nov
20
comment Upload a json file in php
Can you expand your code a little so we can see the context? It's not clear which hook the above is running on or what comes before and after it
Nov
20
comment Upload a json file in php
Where is this code being placed? A meta box? A custom admin page? A frontend template?
Nov
20
revised Upload a json file in php
added 42 characters in body
Nov
20
comment Kento Post Views counter doesn`t work
Have you contacted the Kento Post Views support? I recommend against storing post view counts in the WordPress database as it doesn't scale with traffic and has big performance and reliability issues, use a separate service such as wordpress.com stats or the google analytics api. Also plugin recommendations are offtopic here.
Nov
20
awarded Notable Question
Nov
20
comment current user can edit user?
You should probably be using POST rather than GET for that
Nov
19
answered current user can edit user?
Nov
19
comment current user can edit user?
Can you elaborate on good practice, good practice for what? What are you trying to use this for?
Nov
19
revised current user can edit user?
code formatting
Nov
19
comment Self-hosted Plugins & Themes store with auto-updates?
This question if we ignore the recommendation is extremely broad, you need to break it down, which should be done as part of your specification of what it needs to do and how it needs to do it. Without doing that you're going to face major issues on a development, practical, business, finance, marketing, and management level. Each bullet point alone in your question is a whole collection of super broad questions
Nov
19
comment add posts automaticly under categories in top menu
You're talking specifically about WordPress nav menus using the nav menu system? Not a hardcoded menu or a call to wp_list_pages? Your question has no code/screenshots/examples, and has some ambiguity to it. What have you tried so far?
Nov
19
comment Unable to get all tags from specific categories
WP_Query does exactly what you tell it to do, nothing more, it won't second guess you with things like pagination etc. Are you trying to replace what WordPress grabs in the main query with your own stuff? If so then the pre_get_posts filter is what you want. Also, hardcoding category numbers is very bad practice, perhaps you should use a custom taxonomy to define what goes where and use term names rather than hardcoded category term IDs
Nov
19
comment Ajax add_post_meta()?
If you do this so that when the field changes it saves via ajax, you may have lots of unintended consequences such as revisions and drafts. This is also at odds with how other meta-boxes and post meta saving works. I would strongly advise against this for practical and usability reasons
1 2 3 4 5