Description
Update the post data and meta data for an oik_hook post_type
Usage
oiksc_update_oik_hook( $post, $hook, $context );Parameters
- $post
- ( post ) required – the oik_hook object
- $hook
- ( mixed ) required –
- $context
- ( mixed ) required –
Returns
voidTO DO
We need to stop cache invalidation occurring when this happens and the user is not logged in. Can we simple define( 'WPLOCKDOWN', '1' ) ? BUT we need to allow this logic to be performed when doing AJAX. The fact that the cache might be invalidated is probably OK.Source
File name: oik-shortcodes/admin/oik-shortcodes.phpLines:
1 to 37 of 37
function oiksc_update_oik_hook( $post, $hook, $context ) { if ( !defined( 'DOING_AJAX' ) && !is_user_logged_in() && php_sapi_name() !== "cli" ) { return; } $type = oiksc_get_hook_type( $context ); $post->post_title = oiksc_oik_hook_post_title( $hook, $type ); $docblock_obj = oiksc_load_docblock(); if ( $docblock_obj ) { $docblock = oiksc_get_docblock( $docblock_obj ); $params = oiksc_get_docblock_tags( $docblock_obj ); $post->post_content = oiksc_build_oik_hook_post_content( $docblock, $params ); $_POST['_oik_hook_docblock'] = $docblock; $_POST['_oik_hooks_params'] = $params; } else { $docblock = null; $params = null; } //$docblock = oiksc_get_docblock(); // Don't change the post content but do change the _oik_hook_docblock field // /* Set metadata fields */ $_POST['_oik_hook_name'] = $hook; $_POST['_oik_hook_type'] = $type; $plugin = oiksc_get_plugin(); $file = oiksc_get_filename(); $_POST['_oik_hook_plugin'] = $plugin; $_POST['_oik_hook_source'] = $file; oik_require( "admin/oik-files.php", "oik-shortcodes" ); $_POST['_oik_fileref'] = oiksc_get_oik_fileref( $plugin, $file ); //$_POST['_oik_hook_deprecated_cb'] = false; wp_update_post( $post ); }View on GitHub
Invoked by
Calls
1 to 9 of 9
- oiksc_build_oik_hook_post_content() – Build the post content for an oik_hook //"$docblock<!–more –>[bw_fields][hooks]";
- oiksc_get_docblock() – Return a formatted docblock
- oiksc_get_docblock_tags() – Return the docblock tags for an action hook / filter
- oiksc_get_filename() – Return the filename
- oiksc_get_hook_type() – Return the hook type given the context
- oiksc_get_oik_fileref() – Return the post_id for an oik_file
- oiksc_get_plugin() – Return the post_ID for the plugin name
- oiksc_load_docblock() – Build a docblock object from the most recent docblock
- oiksc_oik_hook_post_title() – Set the post_title for an oik_hook
