Using WPDB to output raw XML fails because of wp-blog-header.php

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 is actually parsed & the template is loaded/rendered: http://example.com/?my_conditional_check

include wp-blog-header not working on MAMP

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: http://ideasilo.wordpress.com/ Text Domain: wpcf7 Domain Path: /languages/ … Read more

Limiting conditional comment to home only in header.php

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=”https://wordpress.stackexchange.com/questions/27299/<?php bloginfo(“template_url’); ?>/scripts/unitpngfix.js”></script> …to this: <?php if( is_home() ) { ?> <!–[if … Read more

Force pdf download not working when include blog-header.php

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: application/octet-stream’); header(‘Content-Disposition: attachment; filename=”file.pdf”‘); readfile(‘file.pdf’); ?> ps: It is informative to … Read more

there’s a way to include a minimal WP for check only the current user, its roles (caps?) and then release/free it?

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 … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)