Skip to content

Instantly share code, notes, and snippets.

View mam4dali's full-sized avatar
😀

MOHAMMAD mam4dali

😀
View GitHub Profile
@mam4dali
mam4dali / wordpress redirect tiny post url to long post slug.php
Created July 17, 2018 13:39
wordpress redirect tiny post url to long post slug
<?php
/*
**** into functions.php ****
Example:
redirect tiny url: http://site.com/?p=1
to long post slug: http://site.com/my-post/
*/
add_action('template_redirect', 'redirect_tiny_url_to_long');
function redirect_tiny_url_to_long(){
if(is_single()){
using System;
using System.Text.RegularExpressions;
public class Test
{
public bool AddToTexBoxOfLine(TextBox box, int lineNumber, string text)
{
if (lineNumber <= 0)
throw new Exception("The number must be 1 or larger\nNumbers smaller than 1 are not acceptable");
<?php
add_action( 'post_submitbox_misc_actions', 'without_update_post_modified_datetime' );
function without_update_post_modified_datetime($post)
{
echo '<div class="misc-pub-section misc-pub-section-last"><span><label><input type="checkbox" value="yes" name="without_update_post_modified_datetime" /> Stop updating post modified date</label></span></div>';
echo '<div class="misc-pub-section misc-pub-section-last"><span><label>Last modified: '.get_the_modified_time('Y/m/d H:i:s', $post).'</label></span></div>';
}
function without_update_post_modified_datetime_save_postdata($data, $postarr)
{
$postid = (!empty($postarr['ID']) && intval($postarr['ID'] > 0) ? intval($postarr['ID']) : (!empty($data['ID']) && intval($data['ID']) > 0 ? intval($data['ID']) : null));