« first day (3292 days earlier)      last day (1641 days later) » 

12:08 AM
no, bug you don't need to resort to SQL for that
and plugins might be hooking into post meta saving etc
just be sure to clear out WP cache so it doesn't fill up and run out of memory
 
 
11 hours later…
11:11 AM
Does wp_remote_*() accept any cookies from the target? The remote URL is banning me, because my requests seem to be rejecting their cookie. I know cURL supports this, but I'm unsure about wp.
Tracing the function will lead to wp-includes\Requests\Transport\cURL.php, in which I can't find any cURL option trying to enable cookies
such as curl_setopt($ch, CURLOPT_COOKIESESSION, true) etc.
 
11:35 AM
you'd have to use the underlying requests library that powers that API
though you could always just use guzzle
 
11:53 AM
I had a dream all our sites branding was torn down and a meta question got opened for brand new proper styling with real input
 
12:08 PM
@TomJNowell What is the alternative? POST requests in the wp rest api?
 
 
1 hour later…
1:09 PM
@abobakrdy you can do that, or just use standard APIs e.g. update_post_meta
WP CLI is great for doing bulk processing
be that a custom command, or using WP CLI subcommands
 
I just read about WP CLI and that does indeed seem like a great option, but i guess it would be slower then doing it though a plugin because its probably doing http requests under the hood
 
1:32 PM
@abobakrdy WP CLI runs on the server
WP CLI doesn't do its job via HTTP requests
think of it as running the PHP in a CLI command process that doesn't have a memory or time limit
rather than it being sent to the browser with a 30second window to do everything
 
1:56 PM
That sounds pretty neat, i first thought it was a CLI for doing remote actions.
 
2:12 PM
it can be used for that, though it will just SSH into the remote server and run the commands there instead, it's rarely used that way
 
Thats true, i didnt think of that lol. Its probably nice sometimes to do some bulk operations remotely if you dont need to clone the whole wp environemt to your locale env.
 
it's mostly convenient for not having to SSH in, e.g. wp @production core install
 
Ive never monitored PHP memory usage before, do you think a script (plugin) that does 2 operations (regexp and db insertion) per post (~1000 posts) in a loop would exceed the 128MB limit or the 30s time limit?
 
the time limit yes
and probably the memory limit
 
Damn, i guess i have to go with the WP CLI method
 
2:19 PM
when you fetch a post, WP puts a copy in WP_Cache so that if you try to fetch it again on the same request, it'll just use the one it grabbed earlier
with an object cache it'll store it in there so it persists across requests
so if you grab 1000 posts, it'll have 1000 posts in memory
so it makes sense to clear those out to stop it from running out
WP CLI commands don't have a time limit, and their memory limits are higher
that doesn't mean you computer now has unlimited RAM though
 
I see. My computer has 8GB of ram so probably more then enough
 
WP CLI has $this->stop_the_insanity() you can call to do that, every 100 or so posts
 
2:49 PM
Do i have to find the command equvilant to that or can you put php code in the bash script?
 
3:24 PM
Nevermind, found out
 
 
2 hours later…
5:48 PM
Ben Popper on October 21, 2019

“We make a huge difference in people’s lives, and it’s not to be underestimated.” – Prashanth Chandrasekar

Last week the Stack Overflow podcast crew sat down with our new CEO to chat about his background in computer science and his vision for the company’s future. What follows is a lightly edited selection of that conversation. To hear the full thing, you can listen to the podcast here. Don’t forget to subscribe for future episodes!

Ben Popper:

Welcome to the Stack Overflow podcast for the week of October 15th I’m here with my co hosts. Say hi everybody. …

 
 
1 hour later…
7:17 PM
Hi everyone,

I'm "new" here (as in this is my first question here).

https://wordpress.stackexchange.com/questions/350960/routing-dynamic-numeric-slug-to-custom-template

I searched for duplicate questions first, and found a few similar ones with no answers - but nothing that helped. Please let me know if I missed something or should fix anything in it.

Cheers!
Julian
 
looks like it would be a custom endpoint to the careers post type.
If I find some time today I think I have an answer to that. Is 123 the Post Type post ID then?
 
https://developer.wordpress.org/rest-api/extending-the-rest-api/adding-custom-endpoints/

cool, looking into that now
well there's no "Post" in the WP sense anymore
the page specific content comes entirely from the API
Ah looks like custom endpoints go in the opposite direction (i.e. exposing my wp posts to an API). I want to take id from slug, pass that as argument to a 3rd party API and handle the results in a template (that integrates nicely, meaning pulls nav, footer etc. and otherwise well behaved)
 
7:34 PM
Do you really have posts in your post type? Or are you wanting to process an arbitrary passed ID to your API and display that information in the single-post template?
 
The second.
 
Do you really need a post type then?
You could create a virtual page custom endpoint. This is a WordPress endpoint not REST endpoint. Article on Metabox.io
 
"virtual page because it is not managed in the WordPress admin area." YES! That's the keyword I didn't know
 
@Julix Also, instead of commenting onto your question you may want to consider editing the question ( using the edit link ) and adding any additional information/resources.
 
I figured since they're more answer related than question related - but not complete enough to be an answer on their own - they'd belong in comments?
 
7:46 PM
Comments are more for users asking/answering clarifications ( sorta what I'm doing here ). You can add a separated section ( maybe separate the sections by <hr /> ) where you can resources or points of interest.
 
a question should have all the information needed to answer it, people don't always trawl through every comment and answer
so make it easy for people to figure out what you're asking and write a good answer first time around
 
I think I did write a good question initially, which leads me to think that the extra resources didn't really help - just added noise. So took them out again.
 

« first day (3292 days earlier)      last day (1641 days later) »