How do I change the author of a custom post type?

in Custom Post Type register arguments array use this ‘supports’ => array(‘title’, ‘editor’, ‘thumbnail’, ‘comments’, ‘author’), This will activate author box on the edit screen. After registering author to cpt you need to activate author from edit screen option ( top of the edit screen where you can enable/disable all metabox ) to display authorbox … Read more

Correct way to enqueue jquery-ui

First of all, WordPress registers jQuery UI via wp_default_scripts(). Dependencies are already set, so you only need to enqueue the script you really need (and not the core). Since you’re not changing version number or anything, it is ok to only use the handle. // no need to enqueue -core, because dependancies are set wp_enqueue_script( … Read more

How to include wp-load.php from any location?

You can use __DIR__ constant. Since the file is either inside plugin or theme folder, which are always located inside wp-content folder.. You can simply get the path of the file and trim everything starting from wp-content from it: $path = preg_replace(‘/wp-content.*$/’,”,__DIR__); If you need to make sure the wp is not inside some wp-content … Read more

Where, When, & How to Properly Flush Rewrite Rules Within the Scope of a Plugin?

The best place to flush rewrite rules is on plugin activation/deactivation. function myplugin_activate() { // register taxonomies/post types here flush_rewrite_rules(); } register_activation_hook( __FILE__, ‘myplugin_activate’ ); function myplugin_deactivate() { flush_rewrite_rules(); } register_deactivation_hook( __FILE__, ‘myplugin_deactivate’ ); See the codex article Apologies in advance, I didn’t make it all the way through your question, so this is a … Read more

How to fork a plugin?

there are several guides in the Codex that can help, Set up your plugin for submission Submit your plugin Keep it up to date I also think it’s a great idea to “fix” older useful plugins 🙂 Steps: http://wordpress.org/extend/plugins/about/ Submit: http://wordpress.org/extend/plugins/add/ How to Use Subversion: http://wordpress.org/extend/plugins/about/svn/ Promotion and additional info: http://codex.wordpress.org/Plugin_Submission_and_Promotion Using subversion depends on … Read more

$_POST form request with admin-post

Maybe a little late but I stumbled on this when I was having issues figuring it out so thought I would supply what I found out for future people. I’ve found the basic principles are to have a hidden input named action and it’s value being a custom set identifier. For example <input name=”action” type=”hidden” … Read more

Get page content using slug

Use get_posts() and the parameter name which is the slug: $page = get_posts([ ‘name’ => ‘your-slug’ ]); if ( $page ) { echo $page[0]->post_content; } Be aware that the post type in get_posts() defaults to ‘post’. If you want a page use … $page = get_posts([ ‘name’ => ‘your-slug’, ‘post_type’ => ‘page’ ]); If you … Read more

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