DB access blocked when initializing WP externally

I accidentally stumbled into the answer today when I forgot to turn on my MAMP managed mysql server. At this juncture it pointed me to the critical difference. This answer is phrased for anyone running MAMP but potentially has broader applicability (certainly LAMP, WAMP, etc.); if you’re experiencing the same problem in an non-MAMP environment … Read more

Rewrite URL variable to custom path

You could add the path via add_rewrite_endpoint, then alter the query via the pre_get_posts action. Here’s a proof-of-concept example that alters the posts_per_page when domain.com/highest-rated/ is requested: // add the endpoint function wpa85664_add_endpoint(){ add_rewrite_endpoint( ‘highest-rated’, EP_ALL ); } add_action( ‘init’, ‘wpa85664_add_endpoint’ ); // check if the endpoint is in the current request // and alter … Read more

Permalinks of New Pages and their Parents

NOTE: The information below is somewhat inaccurate. My mistake. The Page hierarchy is shown in permalinks, and the article I linked to discusses changing it in Posts. Thanks for the correction, @Milo. Original Post: You may not like this answer, but WordPress doesn’t include page hierarchy in urls. It is for use in your theme … Read more

Tags meta box don’t show when creating a new post type

There are essentially two ways to do this. The first is to supply the taxonomies keyword in the register_post_type arguments array, like so: register_post_type(‘my_type’, array( … ‘taxonomies’ => array(‘category’, ‘post_tag’), … )); The other is to register your post type and set up its taxonomies at a later point: register_taxonomy_for_object_type( ‘category’, ‘my_type’ ); register_taxonomy_for_object_type( ‘post_tag’, … Read more