Articles of wp load.php

Proper way to use WordPress function with AJAX PHP file

I have the following jQuery function in my custom-js.js file: $(function() { $(“.product-vote-button-up”).click(function(){ var productID = $(this).attr(‘productID’); var request = $.ajax({ url: “/wordpress/wp-content/themes/my-theme/js/ajax/vote-database-update.php”, type: “POST”, data: {id : productID}, }); request.done(function() { $(“#product-” + productID + ” .item-product-footer-vote-container”).html(‘Thanks for your vote!’); }); request.fail(function(jqXHR, textStatus) { alert( “Request failed: ” + textStatus ); }); }); }); […]

How can I call wp-load.php in my plugin file

I need to call wp-load.php in my plugins file but in case if I call it directly the plugin is not being accepted for wordpress repository and we are been given issue. So please guide me how can we include the “wp-load.php” file in wordpress.

Fetching latest posts from 2 different WP installations

I have three WordPress installations (cannot use multisite; cannot use RSS/Atom feeds) and I am trying to display a date-sorted list of the latest 10 posts from each of the two sub-sites on the main site home page. The site is organized thus: https://www.example.com https://www.example.com/editorials https://www.example.com/news These are three separate installations of WordPress, however sharing […]

wp-load Without Loading the plugins

I am building a ‘control panel’, for my server and would like to use my WordPress userbase to control the login functionality, as well as be able to show some posts. I have set some defines and included wp-load: define( ‘COOKIE_DOMAIN’, false ); define( ‘DISABLE_WP_CRON’, true ); define( ‘WP_USE_THEMES’, false ); define( ‘WP_CACHE’, false ); […]

Why does WP load so many files in the head of source code? How do I optimize it?

I have noticed that wordpress loads a bunch of files into the head of a site. This looks really sloppy and discloses vital information about the file structure of a website. Depending how many plugins are installed a site can easily have 10+ <link> and <script> tags. I understand how these files may work together, […]

How to load wordpress environment without loading the template?

Basically I want to use wordpress functions for example wp_create_user() or wp_update_user() outside of wordpress (outside of wordpress directory). I tried with all the below code snippets to load the wordpress environment, I am able to use the functions correctly in both the cases but the problem is that this also loads the wordpress template […]

Take control of WordPress before functions.php

I’m developing theme and I want to make page cache of static pages in my WordPress theme (and basically I know how to implement it) The problem is that when making theme – the first time when I “get any control” about what is happening is inside functions.php file of theme, and this file is […]

Use wp-load() and wp_head() to render a page's header outside of WordPress

I use wp-load() to load the basic WP environment and then read some info from the DB without any problem. But now i need to render the full header for a page, including the Yoast SEO plugin. After calling wp-load() and getting my data from the DB, i call wp_head() to render the header, but […]

Load Next WordPress Posts With AJAX?

I found an amazing plugin that loads the next posts with Ajax. http://www.problogdesign.com/wordpress/load-next-wordpress-posts-with-ajax However it doesn’t work with custom post types. The code looks fairly simple. Any idea how to edit the code to use custom post types? Thanks

Trying to avoid including wp-load.php

I am working a plugin where I am trying to connect an HR system with WordPress. There is an XML API on the HR system so I have written the plugin to take the data and put it into a WordPress database table specific to my plugin. This is all done via the built in […]