Tag Info

Hot answers tagged

10

There's little difference between the files. When you view a WordPress page, the first file called is index.php. And it is, essentially, your "Method 1:" define('WP_USE_THEMES', true); /** Loads the WordPress Environment and Template */ require ('./wp-blog-header.php'); The blog header file (that queues up the rest of WordPress) loads wp-load.php ...


4

The "right way" is to not include it at all and use WordPress provided means for AJAX in themes and plugins.


2

Method 2, wp-load.php is the access to all functions of WP, that's all. The first line you can remove, not necessarily.


2

In the generic case, there is no performant solution other than to check every file and folder that is publicly accessible, and then all the parent folders. Since this is not a feasible or excusable operation to perform on every page load or request, you're left with two other options: Define the location manually, which is not an unreasonable request ...


2

You're making something completely wrong. Header comment In your main file, you need the following comment on top (ex. taken from Contact form 7): <?php /* Plugin Name: Contact Form 7 Plugin URI: http://contactform7.com/ Description: Just another contact form plugin. Simple but flexible. Author: Takayuki Miyoshi Author URI: ...


2

I think Wordpress is having problem with the url of your external script and throws a 404 error from the handle_404() function in the wp class in /wp-includes/class-wp.php You can try to overcome that using for example status_header(200) <?php define('WP_USE_THEMES', false); require('../wp-blog-header.php'); status_header(200); header('Content-type: ...


2

You can install CI as a theme or a directory in a theme. Then load the files in the theme’s functions.php and create the output with CI. You can use all the WordPress code here. As far as I’m aware there will be no conflicts between CodeIgniter’s reserved names and WordPress. But I am not so sure about the usefulness of this combination. You will not need ...


1

If you place the file in the WP root directory, e.g. http://mysite.com/myscript.php require( dirname(__FILE__) . '../blog/wp-load.php' ); if (function_exists('wp_create_user')) { echo "wp_create_user() found"; } If you are in a different directory, just make sure you are loading wp-load.php from the proper location.


1

Sagive, wp-blog-header.php loaded in the index.php on each page request. AJAX calls included (if that's what you mean "time after time". Then it loads template-loader.php. This has nothing to do with the SQLs you see, and not with the "spikes". Install the Query Monitor plugin to see your SQLs better in the Debug Bar. Do not publish sensitive information ...


1

HTTP is a stateless protocol and it will initialize the whole WordPress system each time a request hits any page in the server. Scripts like wp-blog-header.php, template-loader etc are required to properly initialize WordPress.


1

The no no about loading wp-* files directly are reasonable when you are developing a WordPress plugin or theme, but if you are developing an external code that require WP (and that seems your case) than you must require that files, there is no alternatives. Consider that including wp-blog-header.php is needed when you need to handle WordPress urls, or full ...


1

Include wp-load.php, not wp-blog-header.php. Better yet, hook onto the execution of a standard WordPress request and die early. isset( $_GET['my_conditional_check'] ) && add_action( 'plugins_loaded', 'my_xml_output' ); function my_xml_output() { // do my stuff exit; } This'll run WordPress, then my_xml_output(), then die before the request ...


1

As per the Codex, http://codex.wordpress.org/Integrating_WordPress_with_Your_Website <?php require('/the/path/to/your/wp-blog-header.php'); ?> Whether or not your means and method is foolproof is entirely dependent upon your setup and the locations in which you are placing your scripts, relative to your WordPress installation. Assuming you follow ...


1

wp-includes/general-template.php:2102 is the function wp_admin_css(). On the login page this function is called in login_header(). Your theme or some plugin trys to send an HTTP header after that, probably during the actions login_enqueue_scripts or login_head. wp-includes/option.php on:569 is in function wp_user_settings(); a cookie is set here. Cookies ...


1

Ok, I've fixed it. Turns out that there was a php class name that was getting redeclared. Declared once in the theme, and once in the plugin.


1

There are likely more elegant ways to do this sort of thing, but the quickest and easiest, using your code, would be to move the PHP conditional out of the CSS conditional. e.g. change this: <!--[if lt IE 9]><?php if(is_home() )?> <script type="text/javascript" src="<?php bloginfo('template_url'); ...



Only top voted, non community-wiki answers of a minimum length are eligible