How to disable WordPress blog folder

To clarify, /blog and /blog/ are the same. The slash is added by the browser to properly structure the URL (best way I can explain it). Your’re trying to access two different pages with the /blog/ slug. In this case, WordPress is overriding the blog link from your existing website and showing content from there. … Read more

body_class REST field in WP-API

get_body_class() relies on $wp_query to do its thing, which is apparently a no-go for the JSON API. I considered creating a global object to hold the body class, and just using that to keep the body_class up to date…but that wouldn’t work without page reloads, and there would be no assurance that the object was … Read more

Input data from email form not going to JSON file

I have checked the code. file_put_contents function accepts the absolute path for the file. Use the ‘get_template_directory()’ function for the absolute path. Please check the updated code. <form method=”get”><p id=”myform”><input type=”email” name=”EMAIL” placeholder=”enter email address” required /> <input id=”submit” name=”submit” type=”submit” value=”Sign up” /></p></form> if (isset($_POST[‘submit’])) { $file = get_template_directory() . ‘/data.json’; $json_string = json_encode($_POST, … Read more

data (html) migration to posts

So I solved my problem using the wp_insert_post($array) but before I used wp_insert_post() I had to remove a filter as shown below. remove_filter(‘content_save_pre’, ‘wp_filter_post_kses’); remove_filter(‘content_filtered_save_pre’, ‘wp_filter_post_kses’); // Add code to insert post(s) with html elements here $post = array( ‘post_content’ => ‘<a href=”#” title=”text”>text</a> some random text’, ); wp_insert_post($post); // Then add the filters back … Read more