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

Fatal error: Call to undefined function get_post() with ajax

The problem is that about.php is not a recognized file by WordPress and won’t load any of the actual WordPress functions. <?php wp_header(); ?> in your themes header.php file actually loads most the WordPress functionality that you’re used to using. Since you’re not calling either get_header() OR wp_header() in your about.php file you don’t actually … 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

How to load wordpress environment without loading the template?

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.