最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

actions - trying to add extra field using hooks

programmeradmin0浏览0评论

I am trying to add an extra field on the backend menu of

Edit Subscription menu (SUMO Subscription (plugin) -> List of Subscription -> Edit Subscription)

I am sending you a screenshot for where exactly I would like to add it.

do_action( 'sumosubscriptions_admin_after_general_details' , $post->ID );

// 10 is the priority, higher means executed first
// 1 is number of arguments the function can accept
add_action('sumosubscriptions_admin_after_general_details', 'custom_domain', 10, 1);
function custom_domain($post) {
    // do something
    <input type="text" name="Domain" value="<?php echo $name;?>">
}

I know it's possibly an easy one problem but I haven't succeed to find a solution. Thanks in advance for your help!

I am trying to add an extra field on the backend menu of

Edit Subscription menu (SUMO Subscription (plugin) -> List of Subscription -> Edit Subscription)

I am sending you a screenshot for where exactly I would like to add it.

do_action( 'sumosubscriptions_admin_after_general_details' , $post->ID );

// 10 is the priority, higher means executed first
// 1 is number of arguments the function can accept
add_action('sumosubscriptions_admin_after_general_details', 'custom_domain', 10, 1);
function custom_domain($post) {
    // do something
    <input type="text" name="Domain" value="<?php echo $name;?>">
}

I know it's possibly an easy one problem but I haven't succeed to find a solution. Thanks in advance for your help!

Share Improve this question edited Aug 26, 2019 at 10:50 fuxia 107k39 gold badges255 silver badges459 bronze badges asked Aug 26, 2019 at 9:56 ZabzukiZabzuki 31 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

I'm not familiar with the subscription plugin you're using. But as you're attaching a custom function to a action hook, you should most likely echo or print the html you want to be displayed at that particular point. Like this,

function custom_domain( $post_id ) {
  // if this is saved as post_meta then get it with get_post_meta( $post_id, 'some_meta_key', true );
  $domain = 'someurl'; 
  printf(
    '<input type="text" name="Domain" value="%s">',
    esc_url( $domain )
  );
}
发布评论

评论列表(0)

  1. 暂无评论