Use admin-post to submit form data to external database

I am creating a custom form in WordPress to store and send data to an external database. As part of testing, I was successful in creating a form that submitted form data to the external database by having the form refer back to itself upon clicking the submit button. I now would like to leverage WordPress admin-post functionality instead of having the form refer back to itself. I have set up the action hook correctly as I see the $_POST …
Category: Web

Import images remotly run through timeout error

Actually I delevop a plugin that uses several curl requests to get data from an external server. I've got the following code running and is working fine. The post and meta gets in But if I running the import_images() function for insert each post and multiple image I run into 504 Gateway Timeout and the images duplicates all images. My current PHP VERSION: 7.4, PHP Memory Limit: 512 MB /** * Get all vehicles. * * @return array */ public …
Category: Web

Connect to Ms SQL Server

I've been asked to develop custom plugins which will connect to a database hosted on MS SQL Server in different geographical location, i.e the website is hosted with a hosting service and the database is hosted within the businesses office. I have no idea how to go about remotely connecting the SQL server. Any advice people may offer would be greatly appreciated.
Category: Web

What would be the advantages/disadvantages of remote plugin installation?

Most of us are used to installing plugins directly from the WordPress.org plugin repository. This is the "official" list of available add-ins, and everything hosted there is guaranteed to be GPL. But occasionally developers will list beta releases and non-GPL plugins on their own sites. To install these, you have to download a ZIP file, then either upload it to WordPress through the plugin installer or via FTP. For the unaware, it can be a complicated process because there's no …
Category: Web

Remote database connection and local development

I would like to develope locally meanwhile using a wp remote database. I've been searching for a long time in google and trying some configurations (wp-config.php) without success. I achieve to make it work, but without satisfaction (I have looping redirection, revolution slider not working, etc) I customize this values, and get the remote connection, but maybe there is something about the server path that needs to be configured ¿?: define('DB_NAME', 'db_name'); // remote define('DB_USER', 'db_user'); // remote define('DB_PASSWORD', '123456'); …
Category: Web

Set timeout on wp_remote_post()

I am trying to use wp_remote_post() like this: wp_remote_post( $url, array( 'blocking' => false, 'timeout' => 0.1 ) ); The problem is that it seems to always force the timeout to 1s. I don't even want to wait for 1s, I just want the remote post to start and immediately go back to my the calling function. ( I have also tried setting timeout => 0 but it always takes 1s to return.) How can I skip this minimum of …
Category: Web

How to Create Content Remotely

I'm trying to help populate a newly setup wordpress website and am trying to write scripts to do automated posting of a pre-processed archive of e-mails as a series of posts and comments. I'm completely new to wordpress development and would like to be able to use the wp_insert_post and wp_insert_comment from my remote machine to achieve this. Is it possible?
Category: Web

install / update plugins remotely

This question has apparently found no answer so far: I am looking for a way to update 'existing/ active' plugins froma WP site remotely ; I have seen some indication on how to access the wp repository / plugin info, but the next step is missing : how to grab the updated version of a given plugin & update it (as opposed to completely uninstall the previously active version completely & re-insatlling the newest version all over...) ? I am …
Category: Web

Install plugin remotely

I have seen a couple services ( ManageWP, BlogVault ) where we supply them with the admin login details to our WordPress site and they programmatically install their respective plugin and then connect to it. I am working on a project where I have to migrate a few hundred WordPress sites, doing them individually will be a time consuming task so I am trying to automate it. I have looked into XMLRPC and cURL but have hit a wall. For …
Category: Web

CORS & Remote access to WP via RestAPI

I have built an app which enables the manager of many WP sites to make RestAPI GET, POST, PUT & DELETE requests which work perfectly when using them from this Apps, when the WP site are hosted on the same domain / subdomains. I have added the below lines in the .htaccess of the 'remote WP' not hosted on the same domain, in order, I thought, to enable access to the site remotely: CORS Headers <ifModule mod_headers.c> Header always set …
Category: Web

Remote REST request to check login status

There are 2 wp installations, A and B. Is it possible to do a remote rest request from site A to find out if an user is logged into site B? If yes, how? With this information adjustments would be made on site A according to whether user is logged into site B or not.
Category: Web

Remote plugin activation hook

I am remote activating plugins using update_option('active_plugins,'some_plugins'); It works fine except one thing: if some plugins have to create some tables using register_activation_hook(__FILE__,'activate'); it won't create them. When I'm activating plugins normally in wp-admin/plugins.php it works fine. Any ideas how to remote execute this activation hook or maybe there is different way to better plugin activation?
Category: Web

How do I quickly move between 2 local installations and keep them in sync?

I'm a designer working on my first CMS website. I like to develop on my netbook at the coffee shop, but recently I've been starting to get into graphics heavy content stuff that would be easier to work on, on my desktop. What's the best way to do this? My thought process was, that I could install my database on my Dreamhost server, and then work on the actual wordpress and theme stuff locally, having it point to the remote …
Category: Web

modify post meta data remotely without xmlrpc

I want to make changes to post meta data from another server and had used xml-rpc. After some security concerns were raised, I disabled xmlrpc. I do not have remote access to the MySQL database. I prefer to code a solution in ruby to make this all work. Is there an approach that doesn't require xml-rpc?
Category: Web

How to upload images from my directory into my wordpress?

I'm doing a paste the link onto input and then uses PHP(imagecrop) to crop and store the image onto server directory. $imagesrc = $_GET['img']; $img = file_get_contents($imagesrc); $im = imagecreatefromstring($img); $width = imagesx($im); $height = imagesy($im); $newwidth = '400'; $newheight = '800'; $thumb = imagecreatetruecolor($newwidth, $newheight); imagecopyresized($thumb, $im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); $filename = basename($imagesrc); imagejpeg($thumb,'image/'.$filename); //save image as jpg imagedestroy($thumb); imagedestroy($im); My question is how to upload images that is stored in the directory into …
Category: Web

How to convert and use JSON data from a remote Wordpress server?

I got this code add_action( 'init', 'check_api_data' ); function check_api_data() { if(isset($_GET['api']) ) { if ($_GET['api'] == 'json'){ $args = array( 'post_type' => 'post' ); $query = new WP_Query( $args ); // $query is the WP_Query Object $posts = $query->get_posts(); // $posts contains the post objects $output = array(); foreach( $posts as $post ) { // Pluck the id and title attributes $output[] = array( 'id' => $post->ID, 'title' => $post->post_title, 'content' => $post ->post_content, 'imageurl' => wp_get_attachment_url( get_post_thumbnail_id($post->ID) ) …
Category: Web

Remote install won't find Parent theme when intalling Child Theme, but local install does

On my localhost wordpress install I am using a Parent Theme called "Tesseract", and a Child Theme called "Tesseract-child". Now, I want to deploy my code on a remote WP install and, for some unknown reasons, I am running into problems. On the remote install, the Parent Theme, "Tesseract", installs fine and is listed among the installed themes as it should be. However, when installing the .zip file of my Child Theme, "Tesseract-child", I get this series of messages: Unpacking …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.