Skip to content

Instantly share code, notes, and snippets.

View kbcarte's full-sized avatar

K.B. Carte kbcarte

View GitHub Profile
@kbcarte
kbcarte / query_wp.php
Last active March 16, 2022 16:58
Example of querying wordpress posts, pages, and custom post types, then update the posts
<?php
// this will probably take a while to run
// so don't refresh the page, if the browser complains
// continue to wait
// -1 posts per page will give ALL
// will default to 10 if blank
// default blog posts
$blog_args = array(
@kbcarte
kbcarte / wp_export_db.php
Last active March 16, 2022 16:59
WordPress wp-admin download db backup
<?php
/**
* Checks that the filename has correct extensions
*/
function validate_export( $filename ){
$ext = explode(".", $filename);
if( $ext[1] && $ext[1] != "sql" ){
return false;
}
if( $ext[2] && $ext[2] != "gz" ){
@kbcarte
kbcarte / mount-example.md
Created November 18, 2021 19:13
Mount remote sftp server to local dir

Mounting be explicit with file paths

sshfs <USERNAME>@<SERVER>:/ /home/<PATH TO LOCAL>/ -p 2222

Unmount no trailing slash

fusermount -u ~/