rss2
WordPress – Adam's Perspective
Adam's Perspective · adamadam.blog · American English
WordPress Playground and more
rss2 video content slash wfw atom dc sy
https://adamadam.blog/category/wordpress/feed
- Last post
- Mar 27, 2025
- Posts in 24 h · 7 days · 30 days
- 0 · 0 · 0
- Our last check
- Answering
- Served from
- United States
- Site title
- Adam's Perspective
- Text score at discovery
- 14,151
- Format
- rss2
- Features in the feed
- content, slash, wfw, atom, dc, sy
Posts
What our queue read from this feed. Open one to read it here, or go to the site that published it.
- mysqli_real_escape_string() can be dangerous
Mar 27, 2025 · original
We’ve had prepared statements for years, but the WordPress ecosystem still relies on mysqli_real_escape_string() and it’s scary. Can you find the security issue in this, deceivingly simple, code snippet? $escaped = mysqli_real_escape_string( $connection, $_POST['new_content'] ); $sql = "UPDATE wp_posts SET wp_content='$escaped_string'"; It’s related to text encoding. Adding backslashes to $_POST['new_content'] string can corrupt the data at best, and open up a SQL injection vulnerability at worst. Here’s how. Say I typed this in the form and submitted it as new_content : "成功 Depending on text encoding nuances, my browser can submit these four characters using different byte sequences: In UTF-8, it’s 0x22 0x48 0x54 0x68 0x41 0x56 0x89 In Big5 (used for traditional chinese), it’s 0x22 0xA6 0xA8 0xA5 0x5C . The MySQL connection also has a text encoding – the database must know how to interp - WordPress as a git repo
Jan 8, 2025 · original
During my Christmas break, I’ve turned WordPress into a markdown editor, a git client, and a git server. It’s all dependency-free PHP code. It works in Playground, on any cheap hosting, and it could be merged into WordPress core. Why would I do that? I want Notion that’s free, offline first, and where I own my data. I also want to collaborate with my wife and my improv group. WordPress is the perfect foundation, the hosted version solves many of my problems, but I really want to version my data as static files. The demo A non-video summary I’m dragging and dropping content and media files in and out of WordPress (markdown and HTML is supported today). Saving a page in WordPress changes that file in my local directory. All WordPress changes are synchronized with a GitHub repo. Also, WordPress is a git repo. I’m running git pull and git push with my content files directly against WordPress - Generating 1MB of PHP code with AI, a story of MySQL query parser
Sep 9, 2024 · original
I’ve used Google Gemini to generate a MySQL query parser in PHP and I’ll tell you exactly how. It took two nights, ~$520, and yielded a 1MB MySQLParser.php file that worked out of the box, but not without bugs. This post is just a summary. If you want the full story. check out the original GitHub issue . Why build a PHP parser in the first place? The MySQL to SQLite translation layer that enables WordPress Playground is too easy to crash. All you need is a specific subquery, a UNION select, or the WITH keyword. Technically, it splits the SQL query into tokens and makes decisions based on heuristics like seen keywords or parenthesis nesting level. This approach got Playground very far already, but we’ve reached its limits and need a more reliable foundation. I proposed switching from token processing to AST processing . I believe it would yield clearer, more reliable, and more maintainabl - How to Modify HTML in a PHP WordPress Plugin Using The New Tag Processor API
Feb 16, 2023 · original
Adjusting the HTML markup in PHP has always been a struggle, but WordPress 6.2 makes it a breeze with the WP_HTML_Tag_Processor API. For example, here’s how you can add an alt="" attribute to an img / tag: The PHP code snippets in this post are live! You can edit and re-run them to your heart’s content. Loading live code snippet… Here’s a static version: ?php $html = 'img src="/husky.jpg"' ; $p = new WP_HTML_Tag_Processor ( $html ); if ( $p - next_tag () ) { $p - set_attribute ( 'alt' , 'Husky in the snow' ); } echo $p - get_updated_html (); If you’ve ever struggled to add an HTML attribute using regular expressions, you know how big of an improvement this is! In fact, Tag Processor was born out of this exact struggle. Last year, Dennis Snell and I tried to add a CSS class to the first h1 , h2 , … tag in every WordPress heading block. However, the hours spent on crafting the perfect regu
Discovered by the rss-feed-index crawler, which checks each feed at most once a month.
Same record as JSON: https://api.agentalog.com/api/feeds/fd_adamadam_blog_cb7723a2caaaf022. More from this site: adamadam.blog in the Feeds tab.